Skip to content

Commit

Permalink
fix: add module types (#10299)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Oct 2, 2022
1 parent 7a6d4bc commit 0b89dd2
Showing 1 changed file with 38 additions and 11 deletions.
49 changes: 38 additions & 11 deletions packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ declare module '*.module.pcss' {
const classes: CSSModuleClasses
export default classes
}
declare module '*.module.sss' {
const classes: CSSModuleClasses
export default classes
}

// CSS
declare module '*.css' {
Expand Down Expand Up @@ -61,11 +65,19 @@ declare module '*.pcss' {
const css: string
export default css
}
declare module '*.sss' {
const css: string
export default css
}

// Built-in asset types
// see `src/constants.ts`
// see `src/node/constants.ts`

// images
declare module '*.png' {
const src: string
export default src
}
declare module '*.jpg' {
const src: string
export default src
Expand All @@ -86,10 +98,6 @@ declare module '*.pjp' {
const src: string
export default src
}
declare module '*.png' {
const src: string
export default src
}
declare module '*.gif' {
const src: string
export default src
Expand Down Expand Up @@ -164,12 +172,6 @@ declare module '*.otf' {
}

// other
declare module '*.wasm?init' {
const initWasm: (
options: WebAssembly.Imports
) => Promise<WebAssembly.Instance>
export default initWasm
}
declare module '*.webmanifest' {
const src: string
export default src
Expand All @@ -183,6 +185,14 @@ declare module '*.txt' {
export default src
}

// wasm?init
declare module '*.wasm?init' {
const initWasm: (
options: WebAssembly.Imports
) => Promise<WebAssembly.Instance>
export default initWasm
}

// web worker
declare module '*?worker' {
const workerConstructor: {
Expand All @@ -198,13 +208,30 @@ declare module '*?worker&inline' {
export default workerConstructor
}

declare module '*?worker&url' {
const src: string
export default src
}

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

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

declare module '*?sharedworker&url' {
const src: string
export default src
}

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

0 comments on commit 0b89dd2

Please sign in to comment.