常用类型


Omit, Exclude, Extract, Pick

让编辑器有提示:type LiteralType = 'cat' | 'dog' | (string & {})

type ElementOf = T extends (infer E)[] ? E : never


const list = ['a', 'b', 'c'] as const; // TS3.4 syntax
type NeededUnionType = typeof list[number]; // 'a'|'b'|'c';