forked from determined-ai/shared-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
76 lines (65 loc) · 1.87 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { RouteProps } from 'react-router';
export type Primitive = boolean | number | string;
export type RecordKey = string | number | symbol;
export type UnknownRecord = Record<RecordKey, unknown>;
export type NullOrUndefined<T = undefined> = T | null | undefined;
export type Point = { x: number; y: number };
export type Range<T = Primitive> = [ T, T ];
export type Eventually<T> = T | Promise<T>;
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
export type RawJson = Record<string, any>;
export interface Pagination {
limit: number;
offset: number;
}
export interface FetchOptions {
signal?: AbortSignal;
}
interface ApiBase {
name: string;
stubbedResponse?: unknown;
unAuthenticated?: boolean;
// middlewares?: Middleware[]; // success/failure middlewares
}
// Designed for use with Swagger generated api bindings.
export interface DetApi<Input, DetOutput, Output> extends ApiBase {
postProcess: (response: DetOutput) => Output;
request: (params: Input, options?: FetchOptions) => Promise<DetOutput>;
stubbedResponse?: DetOutput;
}
export interface ApiState<T> {
data?: T;
error?: Error;
isLoading: boolean;
}
export interface SingleEntityParams {
id: number;
}
/* eslint-disable-next-line @typescript-eslint/ban-types */
export type EmptyParams = {}
/**
* Router Configuration
* If the component is not defined, the route is assumed to be an external route,
* meaning React will attempt to load the path outside of the internal routing
* mechanism.
*/
export interface RouteConfig extends RouteProps {
icon?: string;
id: string;
needAuth?: boolean;
path: string;
popout?: boolean;
redirect?: string;
suffixIcon?: string;
title?: string;
}
export type CommonProps = {
children?: React.ReactNode;
className?: string;
title?: string;
};
export interface SemanticVersion {
major: number;
minor: number;
patch: number;
}