获取元组长度 简单 #tuple

by sinoon @sinoon

接受挑战    English 日本語 한국어

创建一个`Length`泛型,这个泛型接受一个只读的元组,返回这个元组的长度。 例如: ```ts type tesla = ['tesla', 'model 3', 'model X', 'model Y'] type spaceX = ['FALCON 9', 'FALCON HEAVY', 'DRAGON', 'STARSHIP', 'HUMAN SPACEFLIGHT'] type teslaLength = Length // expected 4 type spaceXLength = Length // expected 5 ```
返回首页 分享你的解答 查看解答