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 formatting of conditional types #21762

Merged
merged 2 commits into from
Feb 8, 2018
Merged

Conversation

lankaapura
Copy link
Contributor

Fixes #21716, pls review and let me know if there any changes required.

@mhegazy mhegazy merged commit 79dde93 into microsoft:master Feb 8, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Feb 8, 2018

thanks!

@mhegazy
Copy link
Contributor

mhegazy commented Feb 8, 2018

Do you wana get the support for infer as well.. e.g.:

type C<T> = T extends Array<   infer     U  >? U : T;

@lankaapura
Copy link
Contributor Author

@mhegazy I've created a test and it seems this is not related to conditional type formatting. The reason is there are no infer formatting rules defined yet.

How do I proceed? Do you want me to update this PR or are you going to create a new issue?

Code     : "type C<  T  >   =   T   extends   Array   <   infer     U  >   ;"
Expected : "type C<T> = T extends Array<infer U>;"
Actual   : "type C<T> = T extends Array<infer     U>   ;"
Code     : "type C<  T  >   =   T   extends   Array   <   infer     U  >  ? U : T;"
Expected : "type C<T> = T extends Array<infer U> ? U : T;"
Actual   : "type C<T> = T extends Array<infer     U> ? U : T;"

Do you know where can I find more details about infer keyword and examples?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 9, 2018

it seems this is not related to conditional type formatting.

that is correct. the new keyword was added with conditional types, and is only allowed within the extends clause of a conditional type.

The reason is there are no infer formatting rules defined yet.

that is correct

How do I proceed? Do you want me to update this PR or are you going to create a new issue?

If you are interested you can just send a new PR for infer formatting.

Do you know where can I find more details about infer keyword and examples?

Here is the PR that added it: #21496

@lankaapura lankaapura deleted the Fix-21716 branch February 10, 2018 05:35
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 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.

None yet

2 participants