microsoft/TypeScript

Provide better errors on module: node12 and extensionless imports

DanielRosenwasser opened this issue · 0 comments

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.