-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
28 lines (22 loc) · 953 Bytes
/
types.d.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
/** usefull to catch most *units* type errors */
declare type Tagged<O, Tag> = O & { __tag?: Tag }
declare type Branded<O, Brand extends { [key: string]: true }> = O & Brand
declare type Maybe<T> = T | null | undefined
declare type Timestamp = Tagged<number, 'Timestamp'>
// --------------
declare type RelativePath = Branded<string, { RelativePath: true }>
declare type AbsolutePath = Branded<string, { AbsolutePath: true }>
// --------------
declare type ConvertibleImageFormat = 'image/png' | 'image/jpeg' | 'image/webp' | 'raw'
declare type ImageSaveFormat = {
format: ConvertibleImageFormat
prefix?: string
quality?: number
}
// --------------
// because `{}` is something else entirely
declare type EmptyObject = Record<string, never>
// because react types are more complex by default
// let's live in a simplified world
declare type SimpleFC<P> = (props: P) => JSX.Element
// declare type ProplessFC = () => JSX.Element | null