diff --git a/node.d.ts b/node.d.ts index 5d71b10..ac60e42 100644 --- a/node.d.ts +++ b/node.d.ts @@ -37,3 +37,65 @@ declare namespace NodeJS { readonly ELECTRON_RENDERER_URL?: string } } + +// Refer to Vite's ImportMeta type declarations +// + +interface ImportMetaEnv { + MODE: string + DEV: boolean + PROD: boolean +} + +interface ImportGlobOptions { + /** + * Import type for the import url. + */ + as?: AsType + /** + * Import as static or dynamic + * + * @default false + */ + eager?: Eager + /** + * Import only the specific named export. Set to `default` to import the default export. + */ + import?: string + /** + * Custom queries + */ + query?: string | Record + /** + * Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance. + * + * @default false + */ + exhaustive?: boolean +} + +interface KnownAsTypeMap { + raw: string + url: string + worker: Worker +} + +interface ImportGlobFunction { + /** + * Import a list of files with a glob pattern. + * + * https://vitejs.dev/guide/features.html#glob-import + */ + ( + glob: string | string[], + options?: ImportGlobOptions + ): (Eager extends true ? true : false) extends true ? Record : Record Promise> + (glob: string | string[], options?: ImportGlobOptions): Record Promise> + (glob: string | string[], options: ImportGlobOptions): Record +} + +interface ImportMeta { + url: string + readonly env: ImportMetaEnv + glob: ImportGlobFunction +}