Skip to content

Commit

Permalink
docs: remove implicit 'any' and 'Object' types from the docs (#19585)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MarshallOfSound committed Aug 5, 2019
1 parent ee674ac commit cfd230d
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 86 deletions.
12 changes: 6 additions & 6 deletions docs/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ In most cases, you should do everything in the `ready` event handler.

Returns:

* `launchInfo` Object _macOS_
* `launchInfo` unknown _macOS_

Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
the `userInfo` of the `NSUserNotification` that was used to open the application,
Expand Down Expand Up @@ -146,7 +146,7 @@ Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity on
* `userInfo` unknown - Contains app-specific state stored by the activity on
another device.

Emitted during [Handoff][handoff] when an activity from a different device wants
Expand Down Expand Up @@ -189,7 +189,7 @@ Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity.
* `userInfo` unknown - Contains app-specific state stored by the activity.

Emitted during [Handoff][handoff] after an activity from this device was successfully
resumed on another one.
Expand All @@ -201,7 +201,7 @@ Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity.
* `userInfo` unknown - Contains app-specific state stored by the activity.

Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediately, construct a new `userInfo` dictionary and call `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will fail and `continue-activity-error` will be called.

Expand Down Expand Up @@ -949,7 +949,7 @@ allow multiple instances of the application to once again run side by side.

* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - App-specific state to store for use by another device.
* `userInfo` any - App-specific state to store for use by another device.
* `webpageURL` String (optional) - The webpage to load in a browser if no suitable app is
installed on the resuming device. The scheme must be `http` or `https`.

Expand All @@ -972,7 +972,7 @@ Marks the current [Handoff][handoff] user activity as inactive without invalidat

* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - App-specific state to store for use by another device.
* `userInfo` any - App-specific state to store for use by another device.

Updates the current activity if its type matches `type`, merging the entries from
`userInfo` into its current `userInfo` dictionary.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/auto-updater.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The `autoUpdater` object has the following methods:

* `options` Object
* `url` String
* `headers` Object (optional) _macOS_ - HTTP request headers.
* `headers` Record<String, String> (optional) _macOS_ - HTTP request headers.
* `serverType` String (optional) _macOS_ - Either `json` or `default`, see the [Squirrel.Mac][squirrel-mac]
README for more information.

Expand Down
6 changes: 3 additions & 3 deletions docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ is emitted.

#### `BrowserWindow.getExtensions()`

Returns `Object` - The keys are the extension names and each value is
Returns `Record<String, ExtensionInfo>` - The keys are the extension names and each value is
an Object containing `name` and `version` properties.

**Note:** This API cannot be called before the `ready` event of the `app` module
Expand Down Expand Up @@ -724,7 +724,7 @@ is emitted.

#### `BrowserWindow.getDevToolsExtensions()`

Returns `Object` - The keys are the extension names and each value is
Returns `Record<string, ExtensionInfo>` - The keys are the extension names and each value is
an Object containing `name` and `version` properties.

To check if a DevTools extension is installed you can run the following:
Expand Down Expand Up @@ -1381,7 +1381,7 @@ win.loadURL('http://localhost:8000/post', {

* `filePath` String
* `options` Object (optional)
* `query` Object (optional) - Passed to `url.format()`.
* `query` Record<String, String> (optional) - Passed to `url.format()`.
* `search` String (optional) - Passed to `url.format()`.
* `hash` String (optional) - Passed to `url.format()`.

Expand Down
8 changes: 4 additions & 4 deletions docs/api/client-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ following properties:
method.
* `url` String (optional) - The request URL. Must be provided in the absolute
form with the protocol scheme specified as http or https.
* `session` Object (optional) - The [`Session`](session.md) instance with
* `session` Session (optional) - The [`Session`](session.md) instance with
which the request is associated.
* `partition` String (optional) - The name of the [`partition`](session.md)
with which the request is associated. Defaults to the empty string. The
Expand Down Expand Up @@ -134,7 +134,7 @@ Returns:
* `statusCode` Integer
* `method` String
* `redirectUrl` String
* `responseHeaders` Object
* `responseHeaders` Record<String, String[]>

Emitted when there is redirection and the mode is `manual`. Calling
[`request.followRedirect`](#requestfollowredirect) will continue with the redirection.
Expand All @@ -158,7 +158,7 @@ internally buffered inside Electron process memory.
#### `request.setHeader(name, value)`

* `name` String - An extra HTTP header name.
* `value` Object - An extra HTTP header value.
* `value` String - An extra HTTP header value.

Adds an extra HTTP header. The header name will be issued as-is without
lowercasing. It can be called only before first write. Calling this method after
Expand All @@ -169,7 +169,7 @@ the first write will throw an error. If the passed value is not a `String`, its

* `name` String - Specify an extra header name.

Returns `Object` - The value of a previously set extra header name.
Returns `String` - The value of a previously set extra header name.

#### `request.removeHeader(name)`

Expand Down
3 changes: 3 additions & 0 deletions docs/api/content-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ will be returned in the promise.

Returns `Promise<Object>` - Resolves with an object containing the `value` and `percentage` of trace buffer maximum usage

* `value` Number
* `percentage` Number

Get the maximum usage across processes of trace buffer as a percentage of the
full state.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/crash-reporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The `crashReporter` module has the following methods:
* `productName` String (optional) - Defaults to `app.name`.
* `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server. Default is `true`.
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.
* `extra` Object (optional) - An object you can define that will be sent along with the
* `extra` Record<String, String> (optional) - An object you can define that will be sent along with the
report. Only string properties are sent correctly. Nested objects are not
supported. When using Windows, the property names and values must be fewer than 64 characters.
* `crashesDirectory` String (optional) - Directory to store the crash reports temporarily (only used when the crash reporter is started via `process.crashReporter.start`).
Expand Down
4 changes: 2 additions & 2 deletions docs/api/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Returns:

* `event` Event
* `method` String - Method name.
* `params` Object - Event parameters defined by the 'parameters'
* `params` unknown - Event parameters defined by the 'parameters'
attribute in the remote debugging protocol.

Emitted whenever the debugging target issues an instrumentation event.
Expand Down Expand Up @@ -78,7 +78,7 @@ Detaches the debugger from the `webContents`.

* `method` String - Method name, should be one of the methods defined by the
[remote debugging protocol][rdp].
* `commandParams` Object (optional) - JSON object with request parameters.
* `commandParams` any (optional) - JSON object with request parameters.

Returns `Promise<any>` - A promise that resolves with the response defined by
the 'returns' attribute of the command description in the remote debugging protocol
Expand Down
2 changes: 1 addition & 1 deletion docs/api/incoming-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ A `String` representing the HTTP status message.

#### `response.headers`

An `Object` representing the response HTTP headers. The `headers` object is
An `Record<string, string[]>` representing the response HTTP headers. The `headers` object is
formatted as follows:

* All header names are lowercased.
Expand Down
4 changes: 2 additions & 2 deletions docs/api/ipc-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Removes listeners of the specified `channel`.
### `ipcMain.handle(channel, listener)`

* `channel` String
* `listener` Function<Promise> | Function<any>
* `listener` Function<Promise<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]

Expand Down Expand Up @@ -122,7 +122,7 @@ WebContents is the source of the invoke request.
### `ipcMain.handleOnce(channel, listener)`

* `channel` String
* `listener` Function<Promise> | Function<any>
* `listener` Function<Promise<void> | any>
* `event` IpcMainInvokeEvent
* `...args` any[]

Expand Down
2 changes: 1 addition & 1 deletion docs/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The `net` module has the following methods:

### `net.request(options)`

* `options` (Object | String) - The `ClientRequest` constructor options.
* `options` (ClientRequestConstructorOptions | String) - The `ClientRequest` constructor options.

Returns [`ClientRequest`](./client-request.md)

Expand Down
4 changes: 2 additions & 2 deletions docs/api/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ should be called with either a `String` or an object that has the `data`,
* `redirectRequest` Object
* `url` String
* `method` String (optional)
* `session` Object (optional)
* `session` Session | null (optional)
* `uploadData` [ProtocolResponseUploadData](structures/protocol-response-upload-data.md) (optional)
* `completion` Function (optional)
* `error` Error
Expand Down Expand Up @@ -388,7 +388,7 @@ which sends a `Buffer` as a response.
* `redirectRequest` Object
* `url` String
* `method` String (optional)
* `session` Object | null (optional)
* `session` Session | null (optional)
* `uploadData` Object (optional)
* `contentType` String - MIME type of the content.
* `data` String - Content to be sent.
Expand Down
4 changes: 4 additions & 0 deletions docs/api/structures/extension-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ExtensionInfo Object

* `name` String
* `version` String
2 changes: 1 addition & 1 deletion docs/api/structures/trace-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
include in the trace. If not specified, trace all processes.
* `histogram_names` String[] (optional) - a list of [histogram][] names to report
with the trace.
* `memory_dump_config` Object (optional) - if the
* `memory_dump_config` Record<String, any> (optional) - if the
`disabled-by-default-memory-infra` category is enabled, this contains
optional additional configuration for data collection. See the [Chromium
memory-infra docs][memory-infra docs] for more information.
Expand Down
14 changes: 7 additions & 7 deletions docs/api/system-preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Returns `Boolean` - Whether the Swipe between pages setting is on.
### `systemPreferences.postNotification(event, userInfo[, deliverImmediately])` _macOS_

* `event` String
* `userInfo` Object
* `userInfo` Record<String, any>
* `deliverImmediately` Boolean (optional) - `true` to post notifications immediately even when the subscribing app is inactive.

Posts `event` as native notifications of macOS. The `userInfo` is an Object
Expand All @@ -65,15 +65,15 @@ that contains the user information dictionary sent along with the notification.
### `systemPreferences.postLocalNotification(event, userInfo)` _macOS_

* `event` String
* `userInfo` Object
* `userInfo` Record<String, any>

Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.

### `systemPreferences.postWorkspaceNotification(event, userInfo)` _macOS_

* `event` String
* `userInfo` Object
* `userInfo` Record<String, any>

Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.
Expand All @@ -83,7 +83,7 @@ that contains the user information dictionary sent along with the notification.
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
* `userInfo` Record<String, unknown>
* `object` String

Returns `Number` - The ID of this subscription
Expand All @@ -110,7 +110,7 @@ example values of `event` are:
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
* `userInfo` Record<String, unknown>
* `object` String

Returns `Number` - The ID of this subscription
Expand All @@ -123,7 +123,7 @@ This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
* `event` String
* `callback` Function
* `event` String
* `userInfo` Object
* `userInfo` Record<String, unknown>
* `object` String

Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
Expand All @@ -149,7 +149,7 @@ Same as `unsubscribeNotification`, but removes the subscriber from `NSWorkspace.

### `systemPreferences.registerDefaults(defaults)` _macOS_

* `defaults` Object - a dictionary of (`key: value`) user defaults
* `defaults` Record<String, String | Boolean | Number> - a dictionary of (`key: value`) user defaults

Add the specified defaults to your application's `NSUserDefaults`.

Expand Down
17 changes: 5 additions & 12 deletions docs/api/web-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Returns:
* `frameName` String
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` and `other`.
* `options` Object - The options which will be used for creating the new
* `options` BrowserWindowConstructorOptions - The options which will be used for creating the new
[`BrowserWindow`](browser-window.md).
* `additionalFeatures` String[] - The non-standard features (features not handled
by Chromium or Electron) given to `window.open()`.
Expand Down Expand Up @@ -481,7 +481,7 @@ Returns:
* `requestId` Integer
* `activeMatchOrdinal` Integer - Position of the active match.
* `matches` Integer - Number of Matches.
* `selectionArea` Object - Coordinates of first match region.
* `selectionArea` Rectangle - Coordinates of first match region.
* `finalUpdate` Boolean

Emitted when a result is available for
Expand Down Expand Up @@ -669,10 +669,10 @@ Emitted when the devtools window instructs the webContents to reload
Returns:

* `event` Event
* `webPreferences` Object - The web preferences that will be used by the guest
* `webPreferences` WebPreferences - The web preferences that will be used by the guest
page. This object can be modified to adjust the preferences for the guest
page.
* `params` Object - The other `<webview>` parameters such as the `src` URL.
* `params` Record<string, string> - The other `<webview>` parameters such as the `src` URL.
This object can be modified to adjust the parameters of the guest page.

Emitted when a `<webview>`'s web contents is being attached to this web
Expand Down Expand Up @@ -842,7 +842,7 @@ webContents.loadURL('https://github.com', options)

* `filePath` String
* `options` Object (optional)
* `query` Object (optional) - Passed to `url.format()`.
* `query` Record<String, String> (optional) - Passed to `url.format()`.
* `search` String (optional) - Passed to `url.format()`.
* `hash` String (optional) - Passed to `url.format()`.

Expand Down Expand Up @@ -1563,13 +1563,6 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
#### `contents.sendInputEvent(inputEvent)`

* `inputEvent` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)
* `type` String (**required**) - The type of the event, can be `mouseDown`,
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
`mouseMove`, `keyDown`, `keyUp` or `char`.
* `modifiers` String[] - An array of modifiers of the event, can
include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
`numLock`, `left`, `right`.

Sends an input `event` to the page.
**Note:** The [`BrowserWindow`](browser-window.md) containing the contents needs to be focused for
Expand Down
8 changes: 4 additions & 4 deletions docs/api/webview-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ examples.

### `<webview>.sendInputEvent(event)`

* `event` Object
* `event` [MouseInputEvent](structures/mouse-input-event.md) | [MouseWheelInputEvent](structures/mouse-wheel-input-event.md) | [KeyboardInputEvent](structures/keyboard-input-event.md)

Returns `Promise<void>`

Expand Down Expand Up @@ -767,7 +767,7 @@ Returns:
* `requestId` Integer
* `activeMatchOrdinal` Integer - Position of the active match.
* `matches` Integer - Number of Matches.
* `selectionArea` Object - Coordinates of first match region.
* `selectionArea` Rectangle - Coordinates of first match region.
* `finalUpdate` Boolean

Fired when a result is available for
Expand All @@ -791,7 +791,7 @@ Returns:
* `frameName` String
* `disposition` String - Can be `default`, `foreground-tab`, `background-tab`,
`new-window`, `save-to-disk` and `other`.
* `options` Object - The options which should be used for creating the new
* `options` BrowserWindowConstructorOptions - The options which should be used for creating the new
[`BrowserWindow`](browser-window.md).

Fired when the guest page attempts to open a new browser window.
Expand Down Expand Up @@ -872,7 +872,7 @@ webview.addEventListener('close', () => {
Returns:

* `channel` String
* `args` Array
* `args` any[]

Fired when the guest page has sent an asynchronous message to embedder page.

Expand Down
1 change: 1 addition & 0 deletions filenames.auto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ auto_filenames = {
"docs/api/structures/desktop-capturer-source.md",
"docs/api/structures/display.md",
"docs/api/structures/event.md",
"docs/api/structures/extension-info.md",
"docs/api/structures/file-filter.md",
"docs/api/structures/file-path-with-headers.md",
"docs/api/structures/gpu-feature-status.md",
Expand Down
Loading

0 comments on commit cfd230d

Please sign in to comment.