简介 目录 评价 推荐
  • UFO2015 2020-07-11

    _ 误导,js 不存在 private


    截图
    2赞 · 1采集
  • UFO2015 2020-07-11

    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>



    ```


    截图
    1赞 · 0采集
  • 23568 2018-12-19

    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 类型


    声明类成员类型、方法/函数的参数类型和返回类型


    能明确推导时 局部变量/箭头函数 可以不申明类型


    0赞 · 0采集
  • 木木得木木 2018-07-25

    ts小结:

    截图
    0赞 · 0采集
  • 木木得木木 2018-07-25

    申明类型-函数

    截图
    0赞 · 0采集
  • 木木得木木 2018-07-25

    申明类型-变量/常量

    const 常量名:类型

    let 变量名:类型

    var 变量名:类型

    截图
    0赞 · 0采集
  • 木木得木木 2018-07-25

    TypeScript的常见类型

    截图
    0赞 · 0采集
  • 木木得木木 2018-07-25

    TypeScript在JavaScript里面独有的语法

    截图
    0赞 · 0采集
  • 平常不平淡 2018-07-15

    typescript的常见类型

    截图
    0赞 · 0采集
  • objectivezhou 2017-12-28
    申明函数
    截图
    0赞 · 0采集
  • 前端爱你所难 2017-12-10
    一起学习交流的html5技术交流,解答、群 618522268群文件上传了很多的项目实战,大家可以练练手
    截图
    0赞 · 0采集
  • 前端爱你所难 2017-12-10
    一起学习交流的html5技术交流,解答、群 618522268群文件上传了很多的项目实战,大家可以练练手
    截图
    0赞 · 0采集
  • 挤潮 2017-11-27
    hahahaha
    0赞 · 0采集
  • qq_90年的雪飘_0 2017-11-16
    数独.
    截图
    0赞 · 1采集
  • Ariel11 2017-11-06
    数独
    截图
    0赞 · 1采集
  • Ariel11 2017-11-06
    数独
    截图
    0赞 · 1采集
  • 慕哥5055285 2017-11-04
    视频不错
    0赞 · 0采集
  • 平凡的世界4290559 2017-10-27
    烦烦烦烦烦烦烦烦烦
    0赞 · 0采集
数据加载中...
开始学习 免费