-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Better error message for using outdated moduleResolution: node(10) #55104
Comments
People are going to come here and complain if we issue that message and it turns out that the module really isn't there under any setting, and I don't really see a way we could determinatively detect which (if any) other resolution settings would work. |
Hmm. Maybe it can just link to aka.ms/tsconfig#moduleResolution then?
Also, I'm realizing now I meant to suggest in the OP that this message should only be there if any other resolution setting would work. π¬ |
Under different module resolution settings, we could even have entirely different source files under analysis, rendering the original import moot. It's not tractable in the general case IMO |
Could we just have |
Or something more naive where we keep track of whether |
@DanielRosenwasser is it possible to use ambiguous language in the presence of βexportsβ? For example, βThis package may be resolvable using (β¦) because we found type module and exports declared in the packageβ? Iβve only converted a few packages I maintain to be ESM so far, but every time I do I get issues like blakeembrey/change-case#304. The current message isnβt adequate to show the issue is in user configuration and not the package. |
We use "may" a lot of the time, so I'm okay with that. |
Coming back to this - this is a pretty persistent pain-point for users of @typescript-eslint. We've found that a lot of users don't know that:
We've had to keep this pinned issue up and open to give people docs on how to fix the unclear error message, or else they file an issue with us saying our package is broken. I'm sure there are a lot of packages out there who continue to include a I 110% get that we can't make the error message say something so absolute like "you're using For example, would this rough logic be acceptable? |
@andrewbranch does the above sound like something we can do? |
Yes π |
Suggestion
π Search Terms
moduleResolution node node10 eol esm commonjs cannot find types
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
When a TSConfig is using
"moduleResolution": "node"
or"node10"
and an import resolves to an npm package whose types declarations that doesn't support Node < 16, the error message intsc
is very general:Same in VS Code:
Could we please have a secondary message added suggesting that the project be switched to using a more modern
"moduleResolution"
?This message needs bikeshedding, but a starting proposal:
π Motivating Example
This has been a point of confusion in at least typescript-eslint/typescript-eslint#7284. We've gotten a few duplicate reports.
π» Use Cases
Same as βοΈ, I think. I can't think of anything more specific.
The text was updated successfully, but these errors were encountered: