-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Use a symbol for untyped modules to distinguish from unknownSymbol #12352
Conversation
428bb26
to
64f17c5
Compare
src/compiler/checker.ts
Outdated
// Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first. | ||
return undefined; | ||
// Unlike a failed import, an untyped module produces a dummy symbol. This is checked for by `isUntypedOrShorthandAmbientModuleSymbol`. | ||
const untypedSymbol = createSymbol(SymbolFlags.ValueModule, `"${moduleName}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not return unknownSymbol
here instead?
creating a new symbol with no backing declaration would cause other issues in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning undefined
effectively does that. But if we return unknownSymbol
, then getBaseConstructorTypeOfClass
will see that and won't create an error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about a new unknownModule
instead?
… creating a new one for each module.
Fixes #12329
getBaseConstructorTypeOfClass
specifically checks forunknownType
before issuing an error.We actually undid this (and just used
unknownSymbol
) in #11962. So we should be sure this is what we want.