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

Unconstrained type variable not assignable to 'object' #23806

Merged
merged 5 commits into from
May 1, 2018

Conversation

ahejlsberg
Copy link
Member

Fixes #23800.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks good, although the tests don't make all the assertions that the comments in the tests do.

type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; };
type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; };

type a = A<{ a: 0 | 1 }, 0>; // { a: 0; }
Copy link
Member

Choose a reason for hiding this comment

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

the baselines don't actually show that type a = { a: 0 } (or that type b = { a: 0 }.

@ahejlsberg ahejlsberg merged commit 3bfbe68 into master May 1, 2018
@ahejlsberg ahejlsberg deleted the objectAndUnconstrainedTypeParameter branch May 1, 2018 20:24
@ahejlsberg ahejlsberg added this to the TypeScript 2.9 milestone May 1, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 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