# 类型定义

提示

主要是对一些常用 & 复杂类型使用 typescript 进行定义

# index.d.ts


/*
 * @Author: Rainy
 * @Date: 2019-11-14 19:55:36
 * @LastEditors  : Rainy
 * @LastEditTime : 2019-12-29 11:01:00
 */

export class ClassType {}

// Base
export type BaseValueType = number | string;

export type MixedValueType = number | string | boolean;

// Array
export type BaseArrayMap = BaseValueType[];

export type NumberArrayMap = number[];

export type StringArrayMap = string[];

export type AnyArrayMap = unknown[];

export type ArrayMap<T> = T[];

// Object

export type ObjectMap<V> = {
  [name: string]: V;
};

// Function
export type NullFunction = () => null;

export type AnyFunction = () => any;

export type WithParamsReturnAnyFunction = (...arg: any) => any;

export type BaseFunction = () => BaseValueType;

export type MixedFunction = () => MixedValueType;

export type WithParamsFunction = (...arg: any) => MixedValueType;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44