Skip to content

Commit 1963499

Browse files
author
ThomasAribart
committed
v2.7.0-beta.2 release
1 parent f4a9035 commit 1963499

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

builds/deno/index.d.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,21 @@ declare type FromSchemaDefaultOptions = {
5353

5454
declare type And<A, B> = A extends true ? B extends true ? true : false : false;
5555

56-
declare type Compute<A> = A extends Promise<infer T> ? Promise<Compute<T>> : A extends (...args: infer P) => infer R ? (...args: Compute<P>) => Compute<R> : A extends Set<infer V> ? Set<Compute<V>> : A extends object ? {
57-
[key in keyof A]: Compute<A[key]>;
58-
} : A;
56+
declare type DoesExtend<A, B> = [A] extends [B] ? true : false;
5957

60-
declare type DoesExtend<A, B> = A extends B ? true : false;
58+
declare type If<B extends boolean, T, E = never> = B extends true ? T : E;
59+
60+
declare type Key = string | number | symbol;
61+
62+
declare type Compute<A, Seen = never> = A extends Function | Error | Date | {
63+
readonly [Symbol.toStringTag]: string;
64+
} | RegExp | Generator ? A : If<DoesExtend<Seen, A>, A, A extends Array<unknown> ? A extends Array<Record<Key, unknown>> ? Array<{
65+
[K in keyof A[number]]: Compute<A[number][K], A | Seen>;
66+
} & unknown> : A : A extends ReadonlyArray<unknown> ? A extends ReadonlyArray<Record<string | number | symbol, unknown>> ? ReadonlyArray<{
67+
[K in keyof A[number]]: Compute<A[number][K], A | Seen>;
68+
} & unknown> : A : {
69+
[K in keyof A]: Compute<A[K], A | Seen>;
70+
} & unknown>;
6171

6272
declare type DeepGet<O, P extends string[], D = undefined> = P extends [
6373
infer H,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-schema-to-ts",
3-
"version": "2.7.0-beta.0",
3+
"version": "2.7.0-beta.2",
44
"description": "Infer typescript types from your JSON schemas!",
55
"main": "lib/cjs/index.js",
66
"module": "lib/esm/index.js",

0 commit comments

Comments
 (0)