My Sample use case.
type someEnum = 'a' | 'b';
const someObj: { [K in someEnum]: string } = {
a: 'a',
b: 'b',
};
const a: Array<someEnum> = ['a', 'b'];
// In Future update someEnum
type someEnum = 'a' | 'b' | 'c';
// Gives an error;
// Property 'c' is missing in type '{ a: string; b: string; }'
// but required in type '{ a: string; b: string; c: string; }'.
const someObj: { [K in someEnum]: string } = {
a: 'a',
b: 'b',
};
// No error;
const a: Array<someEnum> = ['a', 'b'];
// Is There someThing like;
// const typedArray: [K in someEnum]
It would be really cool to have such a feature; Is there some functionality to achieve the same. Thanks in advance.
type typedArray = Array<someEnum>;- or what feature are you missing?