UNPKG

@silver886/type-json

Version:

TypeScript definitions for JSON

11 lines (10 loc) 577 B
declare type JsonPrimitive = boolean | number | string | null; declare type JsonValue = JsonArray | JsonObject | JsonPrimitive; interface JsonArray extends Array<JsonValue> { } interface JsonObject extends Record<string, JsonValue> { } declare type JsonCompatible<T> = { [P in keyof T]: T[P] extends JsonValue ? T[P] : Pick<T, P> extends Required<Pick<T, P>> ? never : T[P] extends (() => any) | undefined ? never : JsonCompatible<T[P]>; }; export { JsonPrimitive as Primitive, JsonValue as Value, JsonArray as Array, JsonObject as Object, JsonCompatible as Compatible, };