![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
typescript
typescript的简答入门 typescript的简答入门 typescript的简答入门
web修理工
这个作者很懒,什么都没留下…
展开
-
typeScript 模块化 (模板)
文件 IShape.ts (导出模块)namespace Drawing { export interface IShape1 { draw(); }}Circle.ts 文件(导入模块)/// <reference path = "IShape.ts" /> namespace Drawing { export class Circle implements IShape1 { public draw() {原创 2021-03-15 09:40:06 · 187 阅读 · 0 评论 -
typeScript 函数模板
// 函数声-明赋值let str3: number;let f3 = (number3: number): number => { return number3}str3 = f3(5)console.log(str3, '123')// 函数声明赋值let f33 = ({ num3: n }: { num3: number }): number => { return n}let str33 = f33({ num3: 55 })console.原创 2021-03-15 09:37:25 · 658 阅读 · 0 评论 -
typeScript 数组 对象 解构 扩展
// 数据结构let arra: number[] = [100, 200, 300, 400];let arrb: Array<number> = [500, 600, 700, 800]// 全结构let [one, two, three, four] = arra;//部分结构let [o] = arrb;let [, t] = arrb;let [, , , f] = arrb;console.log(one, two, three, four, '======原创 2021-03-15 09:36:27 · 496 阅读 · 0 评论 -
TypeScript 的基本介绍(三)
本文主要对TypeScript中的函数进行展开介绍。主要包括以下内容❏ 函数的创建和类型❏ 函数参数情况说明❏ 泛型函数简单介绍函数的创建和类型函数的创建函数的创建建主要通过两种方式:通过函数声明创建和通过函数表达式创建,在形式上函数又可以被划分文命名函数和匿名函数.此外,TypeScript中还提供了箭头函数支持,在声明箭头函数的时候,我们不再 使用function关键字转而使用=>标记测试变量声明console.log(getName) //函数console.log(getNa转载 2020-09-15 14:02:20 · 223 阅读 · 0 评论 -
TypeScript系列(二)
本文简单介绍TypeScript语言中的以下特性:❏ 解构赋值❏ 函数介绍❏ 命名空间解构&展开//文件路径 ../04-解构和展开/01-解构数组.ts//[001] 解构数组简单介绍//声明变量arrM(数组)let arrM:number[] = [100,200];//解构操作//从arrM数组中提取索引为0和1的元素赋值给新声明的变量one和twolet [one,two] = arrM;console.log("one = " + one); //on转载 2020-09-12 18:34:21 · 315 阅读 · 0 评论 -
TypeScript的语言特性
var let 和const关键字在ES6前,JavaScript中只能通过var关键字声明变量,且没有块级作用域.在TypeScript中,我们声明的时候可以使用 var ,let 或者const关键字.//文件路径 ../01-数据类型/00-声明变量的关键字//[01] var 关键字声明变量console.log(var_zero); //undefinedvar var_zero:number = 1;console.log(var_zero); //1转载 2020-09-12 18:17:45 · 382 阅读 · 0 评论 -
TypeScript的简介
TypeScript系列简介:TypeScript是微软2012年推出的一种编程语言,属于 JavaScript 的超集,可以编译为 JavaScript 执行。它最大特点是强大的类型系统和对ES6的支持,TypeScript托管于GitHub上面。TypeScript代码,通过编译可以转换为纯正的 JavaScript代码,且编译出来的 JavaScript代码能够运行在任何浏览器上。TypeScript 的编译工具也可以运行在任何服务器和任何系统上。设计目标TypeScript从一开始就提出了转载 2020-09-12 17:49:37 · 98 阅读 · 0 评论