chore: type check JS in docs (#38423)

* build(deps): update @electron/lint-roller

* chore: type check JS in docs

* docs: add @ts-check and @ts-expect-error to code blocks

* chore: fix type check errors in docs

* chore: add ts-type to blocks
This commit is contained in:
David Sanders 2023-06-05 15:26:26 +08:00 committed by GitHub
parent 4c89061e0e
commit 905aad9cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 257 additions and 182 deletions

View file

@ -104,6 +104,7 @@ window, you have to set both `parent` and `modal` options:
```javascript
const { BrowserWindow } = require('electron')
const top = new BrowserWindow()
const child = new BrowserWindow({ parent: top, modal: true, show: false })
child.loadURL('https://github.com')
child.once('ready-to-show', () => {
@ -597,7 +598,7 @@ On Linux the setter is a no-op, although the getter returns `true`.
A `boolean` property that determines whether the window is excluded from the applications Windows menu. `false` by default.
```js
```js @ts-expect-error=[11]
const win = new BrowserWindow({ height: 600, width: 600 })
const template = [
@ -1200,6 +1201,9 @@ Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject)
method:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow()
const url = require('url').format({
protocol: 'file',
slashes: true,
@ -1213,6 +1217,9 @@ You can load a URL using a `POST` request with URL-encoded data by doing
the following:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow()
win.loadURL('http://localhost:8000/post', {
postData: [{
type: 'rawData',