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

feat: remove a key definition of ImportMetaEnv #19077

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

yunics-highfield
Copy link

Description

Even if you want to make the type of ImportMetaEnv strict, you can't because [key: string]: any is specified. However, users should be able to choose whether to make the type strict or not.

/** vite-env.d.ts */

/// <reference types="vite/client" />

interface ImportMetaEnv {
  [key: string]: any // If you want to handle ImportMetaEnv ambiguously, add this by yourself.
  readonly MY_ENV: string;
{

@yunics-highfield yunics-highfield changed the title Remove a key definition of ImportMetaEnv feat!: Remove a key definition of ImportMetaEnv Dec 26, 2024
@yunics-highfield yunics-highfield changed the title feat!: Remove a key definition of ImportMetaEnv feat!: ImportMetaEnv Type Improvement Dec 26, 2024
@yunics-highfield yunics-highfield changed the title feat!: ImportMetaEnv Type Improvement feat: ImportMetaEnv Type Improvement Dec 26, 2024
@yunics-highfield yunics-highfield changed the title feat: ImportMetaEnv Type Improvement feat!: Remove a key definition of ImportMetaEnv Dec 26, 2024
@yunics-highfield yunics-highfield changed the title feat!: Remove a key definition of ImportMetaEnv feat!: remove a key definition of ImportMetaEnv Dec 26, 2024
@yunics-highfield yunics-highfield changed the title feat!: remove a key definition of ImportMetaEnv feat: remove a key definition of ImportMetaEnv Dec 26, 2024
@yunics-highfield
Copy link
Author

I'll handle the lint error later.

@sapphi-red sapphi-red added the p2-to-be-discussed Enhancement under consideration (priority) label Dec 27, 2024
@sapphi-red
Copy link
Member

Would you add a document about this here?
https://vite.dev/guide/env-and-mode.html#intellisense-for-typescript

@yunics-highfield
Copy link
Author

What do you think of this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-to-be-discussed Enhancement under consideration (priority)
Projects
Status: Discussing
Development

Successfully merging this pull request may close these issues.

2 participants