A special data type ts

Four. Ts data types

  1. tuple (a tuple type): Specifies the type of data can be stored to the array location specified

    例:let arr:[number, string] = [123, ‘123’];

  1. enum (enumeration): the digital conversion of the identifier

    Example: enum {enum name identifier Shaping = constant, ...};

    Call: the name of the enumeration identifiers (Note: identifiers can be written directly write or string)

  1. any (any type): You can easily type assignment
  2. Anonymous function: var fun = function run (): string {

          return  ‘run’;

        }

  1. The default value of the function:

  Function test (name ?: string) {...}: the name of the parameter with? This parameter can be passed on behalf of not pass, this parameter should be placed last

  Function test (name: string = null) {...}: This parameter has a default value is null if passed

  1. Conversion Type

  this as any: shows a type of this is converted into any

Guess you like

Origin www.cnblogs.com/dlm17/p/12345384.html