Current location - Quotes Website - Signature design - Data and definitions in ts Basic TypeScript
Data and definitions in ts Basic TypeScript
1.js has types

boolean, number, string, array, undefined, null, symbol? (7 kinds)

2.ts has extra types

tuple type (tuple type), enum type (enumeration type) and any type (arbitrary type)

3. Special type

void type: (without any type) means that the definition method has no return value

never type: it is other types (including null and null). To be an optional parameter, the optional parameter must be configured to the last part of the parameter

use ... result:number[] instead of the remaining parameters and define the type.

java overloading refers to two or more functions with the same name, but the function parameters are different, so function overloading will occur at this time.

ts overloading refers to the purpose of trying out multiple functions by providing multiple function definitions for one function.

Method overloading can be used with function selection parameters.

Modifiers in the class

in TS. There are three types of ts: public (public, subclass, outside class) protected (inaccessible outside class) private (inaccessible outside subclass and class)

Reference link:/QQ _ 42451979/Java/article/details/89642575.