Closed
Description
TypeScript Version: master (fc1f6e3)
Code
type X = {
a?: any;
b: any;
}
type Keys = keyof X;
type Direct = {
[K in keyof X]: any;
}
// type Direct = {
// a?: any; - optional
// b: any;
// }
type WithAlias = {
[K in Keys]: any;
}
// type WithAlias = {
// a: any; - required
// b: any;
// }
Expected behavior:
Types Direct
and WithAlias
have the same a
property. I think that a
property must be required in both Direct
and WithAlias
types.
Actual behavior:
Types Direct
and WithAlias
have different a
property (optional and required).