case 1
(情况1)
type ArrayEqualLength<T,?> = [T]
const a: ArrayEqualLength<number,1> = [1,1] // x
const a: ArrayEqualLength<number,1> = [1] // o
const a: ArrayEqualLength<number,2> = [1,1] // o
case 2 GreaterThan
(案例2大于)
type ArrayGreaterThanLength<T,?> = [T]
const a: ArrayGreaterThanLength<number,2> = [1,1] // x
const a: ArrayGreaterThanLength<number,2> = [1] // x
const a: ArrayGreaterThanLength<number,2> = [1,1,1] // o
I want to check array length in typescript!
(我想检查打字稿中的数组长度!)
I can't find it when I search.
(搜索时找不到。)
Help me. (帮我。)
Thanks. (谢谢。)
ask by bugtype kr translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…