ts 中表现元组越界后的行为

index.ts

const lilei: [string, number] = ["Lilei", 23];

lilei.push(NaN); // 3
lilei.push("NaN"); // NaN
lilei.push(true); // string | number -> Error

posted on 2021-09-09 10:25  aisowe  阅读(191)  评论(0编辑  收藏  举报

导航