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: make all moduleResolution values available #4545

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

Conversation

mnahkies
Copy link

@mnahkies mnahkies commented Jun 2, 2024

adds additional members to the ModuleResolutionKind enum to make all possible moduleResolution values available.

the values are based on the enum in typescriptServices.js, namely:

      ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => {
        ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic";
        ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs";
        ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10";
        ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16";
        ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext";
        ModuleResolutionKind3[ModuleResolutionKind3["Bundler"] = 100] = "Bundler";
        return ModuleResolutionKind3;

from a developer experience perspective I would actually prefer if the enum was replaced with the string values that you would use in tsconfig.json as I'd find this more intuitive, but this would be a larger breaking change.

motivation for this change is that I'm building out a playground for my project and it makes use of the exports field in package.json files which require "moduleResolution": "Node16" https://github.com/mnahkies/openapi-code-generator/blob/main/packages/typescript-koa-runtime/package.json#L18-L39

I'm working around by adjusting the .d.ts file locations in the virtual filesystem to drop the dist directory which makes it work, but it would be nicer if I could just leave them in their original locations / not special case these packages.

adds additional members to the `ModuleResolutionKind` enum to make all
possible `moduleResolution` values available.

the values are based on the enum in `typescriptServices.js`, namely:
```javascript
      ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => {
        ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic";
        ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs";
        ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10";
        ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16";
        ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext";
        ModuleResolutionKind3[ModuleResolutionKind3["Bundler"] = 100] = "Bundler";
        return ModuleResolutionKind3;
```

from a developer experience perspective I would actually prefer if the
enum was replaced with the string values that you would use in
`tsconfig.json` as I'd find this more intuitive, but this would be a
larger breaking change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant