
ts
Leon_94
Just Code IT!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
TypeScript经常用到的高级类型
前言 ts入门了一段时间,可是碰上一些高级类型总是一头雾水,还需要去看文档,所以总结了一些工作中经常用到的一些高级类型。所以阅读之前你需要掌握一点儿ts基础。 一、交叉类型 交叉类型将多个类型合并为一个新的类型,新的具有所有参与合并的类型的特性,本质上是一种并的操作。形式如下: T & U //例子: function extend<T , U>(first: T, sec...原创 2019-11-24 16:34:28 · 2591 阅读 · 0 评论 -
TypeScript中的接口
一、可索引的接口 对数组的约束 interface UserArr{ [index:number] : string } let arr:UserArr = ['aaa','bbb'] console.log(arr[0]) // aaa 对对象的约束 interface UserObj{ [key:string]: string | number } const...原创 2019-06-19 15:28:18 · 559 阅读 · 0 评论 -
What's new in TypeScript
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-4.html With union types, you can now specify the desired behavior at both the function declaration site and the call site: (用联合类...原创 2019-06-03 18:39:29 · 308 阅读 · 0 评论 -
TypeScript中的范型
一、定义 比如我们有一个函数,如果不使用范型是这样的 function getData(arg: number): number { return arg; } 它只能传入number类型,如果我们要传入一个string类型的是编译不通过的,所以我们可以写另一个函数或者用any类型 function getData1(arg: string): string { return a...原创 2019-06-20 20:30:34 · 696 阅读 · 0 评论 -
TypeScript中的函数详解
TypeScript中的函数详解原创 2019-06-18 17:51:37 · 831 阅读 · 0 评论