Closed
Description
let xcatliu: [string, number];
xcatliu[0] = 'Xcat Liu';
xcatliu[1] = 25;
这里实际会报错【在赋值前使用了变量“xcatliu”。】
tsc -v 3.2.2
越界的元素中对越界元素的报错定义也有所不同了:
let xcatliu: [string, number];
xcatliu = ['Xcat Liu', 25];
xcatliu.push('http://xcatliu.com/');
xcatliu.push(true);
类型“true”的参数不能赋给类型“string | number”的参数。新版的ts没有Type 'boolean' is not assignable to type 'number'.这样的对应了。
Metadata
Metadata
Assignees
Labels
No labels