Content-Length: 243144 | pFad | https://github.com/vitejs/vite/issues/18080

51B feat: expose `EnvironmentOptions` type by dario-piotrowicz · Pull Request #18080 · vitejs/vite · GitHub
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: expose EnvironmentOptions type #18080

Merged

Conversation

dario-piotrowicz
Copy link
Contributor

Description

As an environment author I might like to implement a factory function like:

export function createMyEnvironment(
  options: ...
) {
  return {
    dev: {
      ...
    },
    build: {
      ...
    },
    ...
  };
}

(example)

The problem here would be that no type checking nor autocompletion would be applied to the return type, so I might need to manually type dev, build etc... if I want to have type checking/autocompletion there (for example in my example notice how I had to set the createEnvironment arguments and return types).

There are also fields on the top environment object that I'd like to have types for too, such as consumer.

So I think it would be pretty convenient to expose the EnvironmentOptions type to vite users.

I am not sure if this was simply missed or exposing this type was considered but not done on purpose for some reason, I figured I could just open this PR and see what you guys say 🙂

Copy link

stackblitz bot commented Sep 11, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev patak-dev added the feat: environment API Vite Environment API label Sep 11, 2024
@patak-dev patak-dev merged commit 35cf59c into vitejs:main Sep 11, 2024
10 of 12 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/expose-environment-options branch September 11, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: environment API Vite Environment API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/vitejs/vite/issues/18080

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy