docs: remove implicit 'any' and 'Object' types from the docs (#19585)

* docs: remove implicit 'any' and 'Object' types from the docs

* docs: more docs improvements, remove all remaining empty interfaces

* chore: update tests for better types
This commit is contained in:
Samuel Attard 2019-08-05 10:45:58 -07:00 committed by GitHub
parent ee674acca4
commit cfd230d7f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 88 additions and 86 deletions

View file

@ -1715,7 +1715,7 @@ describe('BrowserWindow module', () => {
}
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
options.webPreferences!.preload = preload
})
const htmlPath = path.join(fixtures, 'api', 'sandbox.html?window-open')
const pageUrl = 'file://' + htmlPath
@ -1743,7 +1743,7 @@ describe('BrowserWindow module', () => {
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
options.webPreferences!.preload = preload
})
w.loadFile(
path.join(fixtures, 'api', 'sandbox.html'),
@ -1801,7 +1801,7 @@ describe('BrowserWindow module', () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences!.preload = preloadPath
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, args] = await emittedOnce(ipcMain, 'answer')
@ -1818,8 +1818,9 @@ describe('BrowserWindow module', () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences.foo = 'bar'
options.webPreferences!.preload = preloadPath
const prefs = options.webPreferences as any
prefs.foo = 'bar'
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, , webPreferences] = await emittedOnce(ipcMain, 'answer')
@ -1836,8 +1837,8 @@ describe('BrowserWindow module', () => {
})
let childWc: WebContents | null = null
w.webContents.on('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
childWc = options.webContents
options.webPreferences!.preload = preload
childWc = (options as any).webContents
expect(w.webContents).to.not.equal(childWc)
})
ipcMain.once('parent-ready', function (event) {
@ -1955,7 +1956,7 @@ describe('BrowserWindow module', () => {
}
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preload
options.webPreferences!.preload = preload
})
w.loadFile(path.join(fixtures, 'api', 'sandbox.html'), { search: 'reload-remote-child' })
@ -2120,7 +2121,7 @@ describe('BrowserWindow module', () => {
it('should inherit the nativeWindowOpen setting in opened windows', async () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences!.preload = preloadPath
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, args] = await emittedOnce(ipcMain, 'answer')
@ -2129,8 +2130,9 @@ describe('BrowserWindow module', () => {
it('should open windows with the options configured via new-window event listeners', async () => {
const preloadPath = path.join(fixtures, 'api', 'new-window-preload.js')
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = preloadPath
options.webPreferences.foo = 'bar'
options.webPreferences!.preload = preloadPath
const prefs = options.webPreferences! as any
prefs.foo = 'bar'
})
w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
const [, , webPreferences] = await emittedOnce(ipcMain, 'answer')
@ -2186,7 +2188,7 @@ describe('BrowserWindow module', () => {
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = path.join(fixtures, 'api', 'window-open-preload.js')
options.webPreferences!.preload = path.join(fixtures, 'api', 'window-open-preload.js')
})
w.loadFile(path.join(fixtures, 'api', 'window-open-location-open.html'))
const [, args, typeofProcess] = await emittedOnce(ipcMain, 'answer')
@ -2206,7 +2208,7 @@ describe('BrowserWindow module', () => {
})
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
options.webPreferences.preload = path.join(fixtures, 'api', 'window-open-preload.js')
options.webPreferences!.preload = path.join(fixtures, 'api', 'window-open-preload.js')
})
w.loadFile(path.join(fixtures, 'api', 'window-open-location-open.html'))
const [, , , windowOpenerIsNull] = await emittedOnce(ipcMain, 'answer')