Skip to content

Commit

Permalink
fix(types): add '*?.sharedworker' typing (#3618)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naeemo committed Jun 1, 2021
1 parent 82b2bce commit 690ff99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/guide/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ import Worker from './shader.js?worker'
const worker = new Worker()
```

```js
// sharedworker
import SharedWorker from './shader.js?sharedworker'
const sharedWorker = new SharedWorker()
```

```js
// Inlined as base64 strings
import InlineWorker from './shader.js?worker&inline'
Expand Down
7 changes: 7 additions & 0 deletions packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ declare module '*?worker&inline' {
export default workerConstructor
}

declare module '*?sharedworker' {
const sharedWorkerConstructor: {
new (): SharedWorker
}
export default sharedWorkerConstructor
}

declare module '*?raw' {
const src: string
export default src
Expand Down

0 comments on commit 690ff99

Please sign in to comment.