massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / node_modules / ajv / dist / types / jtd-schema.d.ts
index d06b3a2d81be00ba1dcb7fadf7d7a17b7ed80ce4..2a8abb5f2c2b235784e250d6fcff885a99505525 100644 (file)
@@ -1,3 +1,35 @@
+/** numeric strings */
+declare type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32";
+/** string strings */
+declare type StringType = "string" | "timestamp";
+/** Generic JTD Schema without inference of the represented type */
+export declare type SomeJTDSchemaType = (// ref
+{
+    ref: string;
+} | {
+    type: NumberType | StringType | "boolean";
+} | {
+    enum: string[];
+} | {
+    elements: SomeJTDSchemaType;
+} | {
+    values: SomeJTDSchemaType;
+} | {
+    properties: Record<string, SomeJTDSchemaType>;
+    optionalProperties?: Record<string, SomeJTDSchemaType>;
+    additionalProperties?: boolean;
+} | {
+    properties?: Record<string, SomeJTDSchemaType>;
+    optionalProperties: Record<string, SomeJTDSchemaType>;
+    additionalProperties?: boolean;
+} | {
+    discriminator: string;
+    mapping: Record<string, SomeJTDSchemaType>;
+} | {}) & {
+    nullable?: boolean;
+    metadata?: Record<string, unknown>;
+    definitions?: Record<string, SomeJTDSchemaType>;
+};
 /** required keys of an object, not undefined */
 declare type RequiredKeys<T> = {
     [K in keyof T]-?: undefined extends T[K] ? never : K;
@@ -23,10 +55,6 @@ declare type IsElements<T> = false extends IsUnion<T> ? [T] extends [readonly un
 declare type IsValues<T> = false extends IsUnion<Exclude<T, null>> ? TypeEquality<keyof Exclude<T, null>, string> : false;
 /** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */
 declare type IsRecord<T, Union extends boolean> = Union extends IsUnion<Exclude<T, null>> ? null extends EnumString<keyof Exclude<T, null>> ? false : true : false;
-/** numeric strings */
-declare type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32";
-/** string strings */
-declare type StringType = "string" | "timestamp";
 /** actual schema */
 export declare type JTDSchemaType<T, D extends Record<string, unknown> = Record<string, never>> = (// refs - where null wasn't specified, must match exactly
 (null extends EnumString<keyof D> ? never : ({
@@ -56,7 +84,7 @@ export declare type JTDSchemaType<T, D extends Record<string, unknown> = Record<
 } : true extends IsElements<Exclude<T, null>> ? T extends readonly (infer E)[] ? {
     elements: JTDSchemaType<E, D>;
 } : never : true extends IsValues<T> ? T extends Record<string, infer V> ? {
-    values: JTDSchemaType<V>;
+    values: JTDSchemaType<V, D>;
 } : never : true extends IsRecord<T, false> ? ([RequiredKeys<Exclude<T, null>>] extends [never] ? {
     properties?: Record<string, never>;
 } : {
@@ -92,9 +120,13 @@ export declare type JTDSchemaType<T, D extends Record<string, unknown> = Record<
 };
 declare type JTDDataDef<S, D extends Record<string, unknown>> = (S extends {
     ref: string;
-} ? JTDDataDef<D[S["ref"]], D> : S extends {
+} ? D extends {
+    [K in S["ref"]]: infer V;
+} ? JTDDataDef<V, D> : never : S extends {
     type: NumberType;
 } ? number : S extends {
+    type: "boolean";
+} ? boolean : S extends {
     type: "string";
 } ? string : S extends {
     type: "timestamp";