-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingFixedA PR has been merged for this issueA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this
Milestone
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"
abenhamdinekarlhorky
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingFixedA PR has been merged for this issueA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do this