Open cjmling opened 2 years ago
Use Record
Record
For example
const periods : Record<string, string> = {}; can be for periods['a'] = 'aaaaa'; periods['b'] = 'cccccc';
const periods : Record<string, string[]> = {}; can be for periods['a'] = ['aaaaa', 'bbbb']; periods['b'] = ['cccccc' , 'dddd'];
Typescript define dynamic key object type
Use
Record
For example
Typescript define dynamic key object type