Skip to content

Exempt one type declaration from the redeclared export check - Fix #6043 #6044

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

Merged
merged 2 commits into from
Dec 12, 2015

Conversation

weswigham
Copy link
Member

No description provided.

// ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. (TS Exceptions: namespaces, function overloads, enums, and interfaces)
if (!(flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) && declarations.length > 1) {
if (!(flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) && (flags & SymbolFlags.TypeAlias ? declarationLength-- : true) && declarationLength > 1) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you rewrite without -- so I can understand more easily?

Copy link
Member

Choose a reason for hiding this comment

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

I think && (flags & SymbolFlags.TypeAlias ? declarations.length - 2 : declarations.length - 1) is an improvement since 0 is falsy.

Copy link
Member

Choose a reason for hiding this comment

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

Actually && (flags & SymbolFlags.TypeAlias ? declarations.length - 1 : declarations.length) > 1 is even better.

@sandersn
Copy link
Member

:1+:

@weswigham
Copy link
Member Author

Close enough to 👍!

weswigham added a commit that referenced this pull request Dec 12, 2015
Exempt one type declaration from the redeclared export check - Fix #6043
@weswigham weswigham merged commit 5ee0957 into microsoft:master Dec 12, 2015
@sandersn
Copy link
Member

It's the Common Lisp variant. You have to (apply :1+ ...

@weswigham weswigham deleted the redeclared-export-type branch October 12, 2017 08:05
@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