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

Provide better errors on module: node12 and extensionless imports #46152

Closed
DanielRosenwasser opened this issue Sep 30, 2021 · 0 comments · Fixed by #46486
Closed

Provide better errors on module: node12 and extensionless imports #46152

DanielRosenwasser opened this issue Sep 30, 2021 · 0 comments · Fixed by #46486
Assignees
Labels
Domain: Error Messages The issue relates to error messaging Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Fix Available A PR has been opened for this issue Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Sep 30, 2021

When an extensionless import fails from an ES module when moduleResolution is effectively node12/nodenext, we currently issue a useless error message.

// @filename: ./foo.mts
export function foo() {
}

// @filename: ./bar.mts
import foo from "./foo";
// error: Cannot find module './foo' or its corresponding type declarations.

Instead, we should see if we managed to find any files with an extension, or at least mention that an extensionless import is likely to fail.

@DanielRosenwasser DanielRosenwasser added Domain: Error Messages The issue relates to error messaging Suggestion An idea for TypeScript Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Help Wanted You can do this Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". and removed Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". labels Oct 11, 2021
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.5.1 milestone Oct 11, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Error Messages The issue relates to error messaging Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Fix Available A PR has been opened for this issue Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants