We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
本文链接:https://deeptree.me/post/2019/03/tsstart/ 简介:�如何低成本且无痛地上手TypeScript
yarnpkg/yarn#6953
jestjs/jest#7554
num.toFixed(102)
// 字符串 const str: string = 'a' // 布尔值 const isCC: boolean = true // 数值 const LIMIT: number = 10 // 空 function consoleStr(): void { console.log('abc') } // null and undefined const u: undefined = undefined const n: null = null
在⾯向对象语⾔中,接⼝(Interfaces)是⼀个很重要的概念,它是对⾏为的抽象,⽽具体如何⾏动需要由类 (classes)去实现(implements)。
TypeScript 中的接⼝是⼀个⾮常灵活的概念,除了可⽤于 对类的⼀部分⾏为进⾏抽象以外,也常⽤于对「对象的形状(Shape)」进⾏描述。
TypeScript 拥有所有⽬前 ECMAScript class 进⼊标准或还在提案的属性。包括继承、getter、setter、静态⽅法、装饰器等。
在这个基础之上⼜添加 public、private 和 protected 三种修饰符。
class Animal1 { public name: string public constructor(name: string) { this.name = name } } let CatA = new Animal1('a') console.log(CatA.name) CatA.name = 'b' console.log(CatA.name) class Animal2 { private name: string public constructor(name: string) { this.name = name } } let CatC = new Animal2('c') CatC.name = 'c'
class Animal { protected name: string public constructor(name: string) { this.name = name } } class Cat extends Animal { constructor(name: string) { super(name) console.log(this.name) } } // protect和private的区别就是protected可以在子类被访问
泛型(Generics)是指在定义函数、接⼝或类的时候, 不预先指定具体的类型,⽽在使⽤的时候再指定类型的 ⼀种特性。
@babel/preset-typescript
dev: ts-node prod: tsc
typescript-eslint
The text was updated successfully, but these errors were encountered:
No branches or pull requests
本文链接:https://deeptree.me/post/2019/03/tsstart/
简介:�如何低成本且无痛地上手TypeScript
Why TypeScript?
业界动态
Facebook的yarn宣布用TypeScript重写
yarnpkg/yarn#6953
Facebook的Jest宣布用TypeScript重写
jestjs/jest#7554
storybook正在用TypeScript重构中
Vue3也在用TypeScript重构中
Github Trending
Top 10 JavaScript errors from 1000+ projects (Rollbar)
num.toFixed(102)
,RangeErrorThat's Why TypeScript
基础类型
数组
函数
接口(Interface)
在⾯向对象语⾔中,接⼝(Interfaces)是⼀个很重要的概念,它是对⾏为的抽象,⽽具体如何⾏动需要由类 (classes)去实现(implements)。
TypeScript 中的接⼝是⼀个⾮常灵活的概念,除了可⽤于 对类的⼀部分⾏为进⾏抽象以外,也常⽤于对「对象的形状(Shape)」进⾏描述。
类(Class)
TypeScript 拥有所有⽬前 ECMAScript class 进⼊标准或还在提案的属性。包括继承、getter、setter、静态⽅法、装饰器等。
在这个基础之上⼜添加 public、private 和 protected 三种修饰符。
泛型(Generics)
泛型(Generics)是指在定义函数、接⼝或类的时候, 不预先指定具体的类型,⽽在使⽤的时候再指定类型的 ⼀种特性。
How TypeScript?
FrontEnd
@babel/preset-typescript
Node.js
dev: ts-node
prod: tsc
Lint
typescript-eslint
The text was updated successfully, but these errors were encountered: