ts 去年合并了一个 pr 有这个新东西: https://github.com/microsoft/... type T1 = TupleOf<string, 3>; // [string, string, string]如果你使用旧版本的话,使用简单的泛型处理下也可以interface FixedLengthArray<T extends any, L extends number> extends Array<T> { "0": T; length: L; } const tuple: FixedLengthArray<string, 3> = ['a', 'b', 'c']
ts 去年合并了一个 pr 有这个新东西: https://github.com/microsoft/...
如果你使用旧版本的话,使用简单的泛型处理下也可以