-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
30 lines (29 loc) · 1.02 KB
/
types.ts
File metadata and controls
30 lines (29 loc) · 1.02 KB
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
export interface JSONSchema {
$schema?: string;
$ref?: string;
title?: string;
properties?: { [key: string]: JSONSchema };
required?: string[];
type?: string;
const?: string | number | boolean;
enum?: (string | number | boolean)[];
items?: JSONSchema;
$defs?: { [key: string]: JSONSchema }; // (JSON Schema Draft 2019-09 and later)
definitions?: { [key: string]: JSONSchema }; // (JSON Schema Draft-04 to Draft-07)
additionalProperties?: boolean | JSONSchema;
anyOf?: JSONSchema[];
allOf?: JSONSchema[];
oneOf?: JSONSchema[];
description?: string;
default?: any;
format?: string;
}
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Array<infer U>
? Array<DeepPartial<U>> // If it's an array, make each element a DeepPartial
: T[P] extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>> // Handle readonly arrays
: T[P] extends object
? DeepPartial<T[P]> // Apply DeepPartial recursively if it's an object
: T[P]; // Otherwise, just make it optional
};