Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tuple一章实际会报错 #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yinsang opened this issue Dec 10, 2018 · 2 comments
Closed

tuple一章实际会报错 #33

yinsang opened this issue Dec 10, 2018 · 2 comments

Comments

@yinsang
Copy link

yinsang commented Dec 10, 2018

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'.这样的对应了。

@xcatliu xcatliu closed this as completed in 21b163a Sep 2, 2019
@xcatliu
Copy link
Owner

xcatliu commented Sep 2, 2019

在赋值前使用了变量“xcatliu”。

这个应该是你的 eslint 报错?

@xcatliu
Copy link
Owner

xcatliu commented Sep 2, 2019

后者的问题已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants