my-blog icon indicating copy to clipboard operation
my-blog copied to clipboard

[Vssue]type-script

Open shenghy opened this issue 5 years ago • 7 comments

https://jspang.com/posts/2018/06/27/typesript.html

shenghy avatar Apr 18 '19 09:04 shenghy

胖哥,可以不用每次都用VS Code构建任务生成js,使用tsc HelloWorld.ts更简便。

qiujiangtao avatar May 10 '19 09:05 qiujiangtao

"需要注意的是,在TypeScript中指定数据类型的数组只能存储同一类型的数组元素。" 胖哥这句有问题吧?数组元素的类型可以是any啊?any就不会报错

let arr1: any[] = [1, 2, true];

asd8855 avatar May 15 '19 08:05 asd8855

胖哥666

001chinaneil avatar Jun 17 '19 04:06 001chinaneil

不讲泛型的吗?

fishinallblue avatar Jun 26 '19 03:06 fishinallblue

@asd8855

"需要注意的是,在TypeScript中指定数据类型的数组只能存储同一类型的数组元素。" 胖哥这句有问题吧?数组元素的类型可以是any啊?any就不会报错

let arr1: any[] = [1, 2, true];

这句话没错,Any 数组只能存储 Any 类型的数据,只是任何数据都属于 Any 类型而已。就和数组里面也可以存 Object、Union 一样

ImSingee avatar Jul 30 '19 12:07 ImSingee

var a:String = new String('胖哥') 是不是和 var b = new String('胖哥') 是一样的?

xyuwan avatar Sep 03 '19 13:09 xyuwan

胖哥去过泰国吧,这小段子信手拈来

zsx1992 avatar Sep 11 '19 09:09 zsx1992