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

fix(types): add missing options parameter to importMeta #6433

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/vite/types/importMeta.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/* eslint-disable @typescript-eslint/consistent-type-imports */

import type { AssertOptions } from '../src/node/importGlob'

interface ImportMeta {
url: string

Expand Down Expand Up @@ -50,14 +52,20 @@ interface ImportMeta {

readonly env: ImportMetaEnv

glob(pattern: string): Record<
glob(
pattern: string,
options?: AssertOptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review. But we can't import types in this ambient type module. It will fail to provide completion for Vite client types. So we need to import like import('../src/node/importGlob').AssertOptions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can we have ESLint warns about type importing? I couldn't find like /* eslint-warn @typescript-eslint/consistent-type-imports */

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ydcjeff thanks for being on top of this, would you make a PR with the needed changes?

): Record<
string,
() => Promise<{
[key: string]: any
}>
>

globEager(pattern: string): Record<
globEager(
pattern: string,
options?: AssertOptions
): Record<
string,
{
[key: string]: any
Expand Down