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

Use a symbol for untyped modules to distinguish from unknownSymbol #12352

Merged
6 commits merged into from
Mar 1, 2017

Conversation

ghost
Copy link

@ghost ghost commented Nov 18, 2016

Fixes #12329

getBaseConstructorTypeOfClass specifically checks for unknownType before issuing an error.

We actually undid this (and just used unknownSymbol) in #11962. So we should be sure this is what we want.

@ghost ghost force-pushed the untyped_module_symbol branch from 428bb26 to 64f17c5 Compare November 18, 2016 15:51
// 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}"`);
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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?

@ghost ghost merged commit 6906002 into master Mar 1, 2017
@ghost ghost deleted the untyped_module_symbol branch March 1, 2017 18:38
@ghost ghost mentioned this pull request Apr 5, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants