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

fix parsing of leading union/intersection operator #31265

Merged
merged 2 commits into from May 8, 2019

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented May 5, 2019

Fixes: #30995

A leading | or & is now part of the union/intersection type's range.
If there's a leading operator and only one constituent type, we still parse a union/intersection type.

@ajafff
Copy link
Contributor Author

ajafff commented May 7, 2019

Closing in favor of #31017

@ajafff
Copy link
Contributor Author

ajafff commented May 8, 2019

Reopening as this PR actually fixes the floating token issue if there's no further operator

@ajafff ajafff reopened this May 8, 2019
@ajafff
Copy link
Contributor Author

ajafff commented May 8, 2019

@rbuckton I added the test case you requested in #31017 (comment): declaration emit ignores leading comments of the leading operator.

@rbuckton
Copy link
Member

rbuckton commented May 8, 2019

Looks good, thanks!



//// [unionTypeWithLeadingOperator.d.ts]
export declare type D = /*leading1*/ 1 | /*leading2*/ 2;

Choose a reason for hiding this comment

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

why /*trailing1*/ is removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leading |/& is not included in the intersection/union node
3 participants