摘要: 函数类型 在 JavaScript 中,有两种常见的定义函数的方式——函数声明(Function Declaration)和函数表达式(Function Expression)。 在 js 中,定义一个函数有一下两种方式: // 函数声明 命名函数 function add(x, y) { retu 阅读全文
posted @ 2023-12-25 17:55 我是+V 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 接口约束数组 超级烦人 接口约束 接口也可以用来描述数组: interface INewArray { [index: number]: number } let arr: INewArray = [1, 2, 3] INewArray 表示:只要索引的类型是数字时,那么值的类型必须是数字。 虽然接 阅读全文
posted @ 2023-12-25 16:24 我是+V 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 接口 超级烦 什么是接口 在 TypeScript 中,我们使用接口(Interfaces)来定义对象的类型。 在面向对象语言中,接口(Interfaces)是一个很重要的概念,它是对行为的抽象,而具体如何行动需要由类(classes)去实现(implement)。 TypeScript 中的接口是 阅读全文
posted @ 2023-12-25 15:24 我是+V 阅读(3) 评论(0) 推荐(0) 编辑
摘要: TypeScript 类型声明、数据类型 好烦 数据类型 JavaScript 的类型分为两种:原始数据类型(Primitive data types)和对象类型【引用数据类型】(Object types)。 原始数据类型包括:布尔值、数值、字符串、null、undefined 以及 ES6 中的新 阅读全文
posted @ 2023-12-25 14:58 我是+V 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 1. TypeScript 简介 烦 教程地址 教程资源:https://ts.xcatliu.com/introduction/what-is-typescript.html#link-1 中文官网:https://www.typescriptlang.org/ TypeScript 特点 JS的 阅读全文
posted @ 2023-12-25 14:58 我是+V 阅读(4) 评论(0) 推荐(0) 编辑