
TypeScript
文章平均质量分 77
TypeScript-js的超集
Prosper Lee
谁又能来拯救我这灰暗的人生呢……
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
TS(五):装饰器
修改 类装饰器定义并使用装饰器对比不使用装饰器装饰器叠加实现消息提示统一响应装饰器工厂方法装饰器登录状态验证数据请求服务端客户端原创 2023-10-13 13:22:13 · 409 阅读 · 0 评论 -
TS(四):TypeScript入门
TypeScript入门`tsconfig.json` - `compilerOptions``target``lib``module`、`moduleResolution``sourceMap``resolveJsonModule``isolatedModules``forceConsistentCasingInFileNames``strict``esModuleInterop``skipLibCheck`示例数据类型 及 部分操作type interface 区别`type 不可重复定义, inter原创 2022-05-16 14:35:28 · 885 阅读 · 0 评论 -
TS(三):变量声明、函数
变量声明var let constconst是对let的一个增强,它能阻止对一个变量再次赋值函数function 函数名(参数1: 类型, 参数2: 类型): 返回值类型(void 无返回值){ /* CODE */}function getInfo(name: string, age: number): string { return name + age;}可选参数 定义参数可传可不传(需要定义在必传参数之后)function getInfo(name: string, a原创 2020-10-24 17:23:41 · 1296 阅读 · 0 评论 -
TS(二):数据类型
布尔值 booleanlet isDone: boolean = false;数字 numberlet decLiteral: number = 6;let hexLiteral: number = 0xf00d;let binaryLiteral: number = 0b1010;let octalLiteral: number = 0o744;字符串 stringlet str: string = `Gene`;let age: number = 37;let sen.原创 2020-07-24 13:03:04 · 371 阅读 · 0 评论 -
TS(一):安装、使用TypeScript
安装npm install -g typescript编译tsc 文件路径示例新建一个greeter.ts文件,定义一个类class Student { fullName: string; constructor(public firstName, public middleInitial, public lastName) { this.fullName = firstName + " " + middleInitial + " " + lastName原创 2020-07-22 09:36:39 · 311 阅读 · 0 评论