📄️ React 中的类型
typescript type ReactText = string | number; type ReactChild = ReactElement | ReactText;
📄️ Utility Type
这玩意 TS 的官网介绍的有点坑,其实就是用来构造一个对象的,就是作为对象的一系列属性的类型,所以只能是或者字面量类型,就是属性值的类型,这就很多了,只要是 ES 规范定义的类型都能往里扔。
📄️ d.ts文件
对于环境声明文件内部每个根级别的变量,函数声明等都必须使用 TypeScript 的(声明)关键字作为前缀,声明语法是隐藏内部实现细节的做法,也就是只会暴露函数,变量等类型,参数等,例如声明的全局变量:
📄️ Interface
> One of TypeScript’s core principles is that type checking focuses on the _shape_ that values have. This is sometimes called “duck typing” or “structural subty
📄️ tsconfig.json 文件配置
根据 TypeScript 官方文档的介绍,tsconfig.json 用于指定 TypeScript 项目的根目录以及指定编译选项。TypeScript 本身提供了一些基于不同运行时环境的 tsconfig.json 的配置项 —— 。
📄️ TypeScript类型系统
typescript // 方法一 const person = [{ name: 'oxygen', age: 20 }].find(item => item.age === 20) || { name: '', age: 0, };
📄️ 高级类型
todo