Skip to content

Use the value symbol for decorator purpose only if it is same as type symbol#13584

Merged
sheetalkamat merged 2 commits into
masterfrom
decoratorMetadata
Jan 20, 2017
Merged

Use the value symbol for decorator purpose only if it is same as type symbol#13584
sheetalkamat merged 2 commits into
masterfrom
decoratorMetadata

Conversation

@sheetalkamat
Copy link
Copy Markdown
Member

Fixes #13155

Comment thread src/compiler/checker.ts

// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
const typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
if (valueSymbol && valueSymbol === typeSymbol) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wanna be enlightened about how Typescript type checker works:

if there's already a value called "Event" (like the DOM.Event class) and there is a type declared that is named "Event" and they are equal, we will assume that the reference is to the type rather than to the value?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declarations do merge in TS, see http://www.typescriptlang.org/docs/handbook/declaration-merging.html for more details.

@ghost
Copy link
Copy Markdown

ghost commented Jan 20, 2017

thanks for fixing this bug!! 🍾 💯

@sheetalkamat sheetalkamat merged commit a185ddc into master Jan 20, 2017
@sheetalkamat sheetalkamat deleted the decoratorMetadata branch January 20, 2017 21:46
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

3 participants