type Enum<
T extends readonly string[],
B extends boolean = false,
> = {
readonly [
Key in keyof T as Key extends `${infer I extends number}`
? Capitalize<T[I]>
: never
]: B extends false
? T[Key]
: Key extends `${infer I extends number}`
? I
: never
}
有没有老哥帮忙解释一下的?
原题地址