-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstandard-types.ts
34 lines (34 loc) · 1.25 KB
/
standard-types.ts
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
/**
* Optional
* @desc Type representing [`Optional`] in TypeScript: `T | null | undefined`
*/
export type Optional<T> = T | null | undefined
//--------------------------------------------------------------------------------------------------
/**
* Undef
* @desc Type representing [`Undef`] in TypeScript: `T | undefined`
*/
export type Undef<T> = T | undefined
//--------------------------------------------------------------------------------------------------
/**
* Keys
* @desc Type representing [`Keys`] in TypeScript: `T`
*/
export type Keys<T> = keyof T
//--------------------------------------------------------------------------------------------------
/**
* Processor
* @desc Type representing processor function type in TypeScript
* @example
* type Processor = (v) => return new String(v)
*/
export type Processor<T, V> = (v: T) => V
//--------------------------------------------------------------------------------------------------
/**
* BiConsumer
* @desc Type representing binary consumer function type in TypeScript
* @example
* type BiConsumer = (v1, v2) => console.log(v1 + ":" + v2)
*/
export type BiConsumer<T, V> = (v1: T, v2: V) => void
//--------------------------------------------------------------------------------------------------