Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update import.meta.glob jsdocs #9709

Merged
merged 2 commits into from Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions packages/vite/types/importGlob.d.ts
Expand Up @@ -38,7 +38,9 @@ export interface KnownAsTypeMap {

export interface ImportGlobFunction {
/**
* 1. No generic provided, infer the type from `eager` and `as`
* Import a list of files with a glob pattern.
*
* Overload 1: No generic provided, infer the type from `eager` and `as`
*/
<
Eager extends boolean,
Expand All @@ -51,14 +53,18 @@ export interface ImportGlobFunction {
? Record<string, T>
: Record<string, () => Promise<T>>
/**
* 2. Module generic provided, infer the type from `eager: false`
* Import a list of files with a glob pattern.
*
* Overload 2: Module generic provided, infer the type from `eager: false`
*/
<M>(
glob: string | string[],
options?: ImportGlobOptions<false, string>
): Record<string, () => Promise<M>>
/**
* 3. Module generic provided, infer the type from `eager: true`
* Import a list of files with a glob pattern.
*
* Overload 3: Module generic provided, infer the type from `eager: true`
*/
<M>(
glob: string | string[],
Expand All @@ -68,7 +74,9 @@ export interface ImportGlobFunction {

export interface ImportGlobEagerFunction {
/**
* 1. No generic provided, infer the type from `as`
* Eagerly import a list of files with a glob pattern.
*
* Overload 1: No generic provided, infer the type from `as`
*/
<
As extends string,
Expand All @@ -78,7 +86,9 @@ export interface ImportGlobEagerFunction {
options?: Omit<ImportGlobOptions<boolean, As>, 'eager'>
): Record<string, T>
/**
* 2. Module generic provided
* Eagerly import a list of files with a glob pattern.
*
* Overload 2: Module generic provided
*/
<M>(
glob: string | string[],
Expand Down