当我尝试在打字稿中使用toSorted方法时,如下所示:
const x = [1,2]; const y = x.toSorted();
我收到此 ts 错误:
类型“number[]”上不存在属性“toSorted”。ts(2339)
toReverse () 和toSplice () 方法也会发生这种情况
sorting typescript
sorting ×1
typescript ×1