You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should compile, I think. { [K in keyof G]: string } does satisfy { [key: string]: string }.
Actual behavior:
The compiler outputs the following:
type-error-demo.ts(9,61): error TS2344: Type '{ [K in keyof G]: string; }' does not satisfy the constraint 'Group'.
Use case:
This is a larger example which is closer to the original use case. The idea is to add "keys" to the passed in object's values based on the passed in object's keys.
TypeScript Version: 2.2.1
Code
Expected behavior:
This should compile, I think.
{ [K in keyof G]: string }
does satisfy{ [key: string]: string }
.Actual behavior:
The compiler outputs the following:
Use case:
This is a larger example which is closer to the original use case. The idea is to add "keys" to the passed in object's values based on the passed in object's keys.
A hacky way to make this compile involves adding a generic to AttributeSet that contains its keys, and letting typescript infer them:
The problem with this is that it causes
tsc
to fail further through the application code -- see my comment in #14723The text was updated successfully, but these errors were encountered: