ClishWang

Results 8 comments of ClishWang

> @zb-0819 > interface Person { > name: string; > age?: number; > [propName: string]: string | number; > } > > let tom: Person = { > name: 'Tom',...

> @onePieceGuo > 请问,如果当rest剩余参数和非必传参数共存的时候,那个优先权更加高,如何让这2个共存,我尝试过,把非必传放在rest前面,这时候非必传就变成了必传,但是放在后面rest会报错 ```javascript function reverse(x: number, y?: number, ...rest: Array): number { console.log(rest); if (typeof y === 'number') { return x + y; } return x; } ```...

> @blanklong28 > > @qq1090871975 > > 能说说断言一般用在什么地方吗?假如A变量为number类型,B变量为string类型,A.length会提示报错,所以用了A as B来使A.length不提示报错,我看教程理解是这个意思,不是很明白这个操作有什么用?运行不还是会报错吗?感觉有点像try{}catch{},但是又不是,存在肯定有它的意义,能举一些例子让我们这些入门的人明白断言具体什么情况下用吗? > > 在两个类型没有兼容的情况下,是不能进行断言的。就像说的 string as number会报错。 > 我有时候想偷懒的时候就会用到断言。 > eg: > ``` > interface IForm { > id: number; >...

> @pumpkinduan > > @394104177 > > > @liantianyun > > > 上一节不是说:一旦定义了任意属性,那么确定属性和可选属性的类型都必须是它的类型的子集。那为什么 > > > { > > > [index: number]: number; > > > length: number; > >...

这些更有用!

完整看完了一遍,收获颇丰。感谢~

> @AlaxLee > 那么这个 hello.js 怎么执行呢? 不用执行,看看就行

I have the same problem,when the "document.hidden = true" animations will blocked. countdown behavior to be confused.