-
_ 误导,js 不存在 private
查看全部 -
TypeScript Types
Any, Void, Never
Interface, Tuple, Enum# TypeScript Types
https://www.typescriptlang.org/docs/handbook/basic-types.html
https://www.typescriptlang.org/docs/handbook/advanced-types.html
```ts
Boolean
Number
String
Array
Tuple
Enum
Any
Void
Null and Undefined
Never
Object
// Type assertions
// A note about ‘let’
```
```ts
Intersection Types
Union Types
Type Guards and Differentiating Types
User-Defined Type Guards
Using type predicates
Using the in operator
typeof type guards
instanceof type guards
Nullable types
Optional parameters and properties
Type guards and type assertions
Type Aliases
Interfaces vs. Type Aliases
String Literal Types
Numeric Literal Types
Enum Member Types
Discriminated Unions
Exhaustiveness checking
Polymorphic this types
Index types
Index types and index signatures
Mapped types
Inference from mapped types
Conditional Types
Distributive conditional types
Type inference in conditional types
Predefined conditional types
```
https://www.typescriptlang.org/docs/handbook/utility-types.html
```ts
Partial<T>
Readonly<T>
Record<K,T>
Pick<T,K>
Omit<T,K>
Exclude<T,U>
Extract<T,U>
NonNullable<T>
Parameters<T>
ConstructorParameters<T>
ReturnType<T>
InstanceType<T>
Required<T>
ThisParameterType
OmitThisParameter
ThisType<T>
```
查看全部 -
TS的特点:
查看全部 -
TS 常见类型
Boolean Number String Array
Tuple Enum interface class
Any Void Null Undefined Never(某个函数不可返回)
变量声明
const/var/let 变量: 类型
函数声明
function 函数名(参数1: 类型1, 参数2: 类型2): 返回类型 {}
箭头函数
(参数1: 类型1, 参数2: 类型2):返回类型 => {}
类成员的声明
class 类名 {
// 私有变量
private _x: number;
private _y: number;
...
}
未声明类型默认作为 any 类型
声明类成员类型、方法/函数的参数类型和返回类型
能明确推导时 局部变量/箭头函数 可以不申明类型
查看全部 -
ts小结:
查看全部 -
申明类型-函数
查看全部 -
申明类型-变量/常量
const 常量名:类型
let 变量名:类型
var 变量名:类型
查看全部 -
TypeScript的常见类型
查看全部 -
TypeScript在JavaScript里面独有的语法
查看全部 -
typescript的常见类型
查看全部 -
mac下删除文件命令
rm *.js -s rm **/*.js -s
查看全部 -
[代码](https://gitee.com/jamesfancy/sudoku)查看全部
-
jlkjlkkl查看全部
-
申明函数查看全部
-
我的笔记查看全部
举报