Closed
Description
At google, we've had a number of users trip over import syntax when working with libraries that have default exports.
Given this scenario:
has_named_export.ts
export var a = 1;
has_default_export.ts
var b = '';
export default b;
- Users often do:
import {b} from './has_default_export';
which gives:
Error: module has no exported member 'b'
Request: the error could be more helpful, like "did you mean to import the default export, with no curly braces"
This is especially likely when the name of the default export matches the named import.
Novice users look at has_default_export
and think that B should be importable, and may never have worked with default exports.
- Also possible:
import a from './has_named_export';
"has_named_export" has no default export
This one is less frequent, but it could say "did you mean to import the named import 'a' by using curly braces"