-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Pick turns optional parameters into required ones when union types are used #20722
Comments
kujon
changed the title
Pick turns optional parameters into required ones when union types are used:
Pick turns optional parameters into required ones when union types are used
Dec 15, 2017
I just ran into this. Here is another example. type Foo =
| {
optionalProp?: string;
}
| {
optionalProp?: string;
};
// `optionalProp` is no longer optional
type Foo2 = Pick<Foo, keyof Foo>; |
Related to #14295? |
1 task
9 tasks
Ouch, yeah this just got me. |
This issue if fixed, can be closed |
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TypeScript Version: 2.6.2
Code
Expected behavior:
The above code compiles, since
foo
is optional in both typeA
and typeB
.Actual behavior:
foo
is turned into a required parameter.The text was updated successfully, but these errors were encountered: