Open AndreGeng opened 5 years ago
const enum DurationUnit { y = 'y', mo = 'mo', w = 'w', d = 'd', h = 'h', m = 'm', s = 's', ms = 'ms', } export type DurationUnitKey = keyof typeof DurationUnit;
解释见keyof Enum
['1', '2'].reduce((acc, item) => { acc.push(item); return acc; }, [])
空数组被推断出的type为never, 这里把空数组类型强转为string[]. [] as string[]
解释见keyof Enum
空数组被推断出的type为never, 这里把空数组类型强转为string[]. [] as string[]