-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Mapped type with enum keys produces {} #23084
Labels
Duplicate
An existing issue was already created
Comments
The problem is that const enum E { A }
interface I { [E.A]: number; }
type T = { [K in keyof I]: boolean }; // Fails
type Bools<T> = { [K in keyof T]: boolean };
type B = Bools<I>; // No error, returns {} |
ghost
changed the title
Array of mapped generic type allows invalid object assignments
Mapped type with enum keys produces {}
Apr 2, 2018
Duplicate of #13042. |
|
mhegazy
added
Duplicate
An existing issue was already created
and removed
Bug
A bug in TypeScript
labels
Apr 2, 2018
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TypeScript Version: 2.9.0-dev2.0180402
Search Terms: mapped generic type array
Code
Expected behavior:
Both assignments have compile errors (number not assignable to boolean) (This is the behavior on 2.7.2)
Actual behavior:
Only the unmapped type assignment has a compile error.
Playground Link
Related Issues:
The text was updated successfully, but these errors were encountered: