@sinclair/typebox 0.34.7 → 0.34.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,9 +13,11 @@ import { type TIterator } from '../iterator/index';
|
|
|
13
13
|
import { type TKeyOf } from '../keyof/index';
|
|
14
14
|
import { type TObject, type TProperties } from '../object/index';
|
|
15
15
|
import { type TOmit } from '../omit/index';
|
|
16
|
+
import { type TOptional } from '../optional/index';
|
|
16
17
|
import { type TPick } from '../pick/index';
|
|
17
18
|
import { type TNever } from '../never/index';
|
|
18
19
|
import { TPartial } from '../partial/index';
|
|
20
|
+
import { type TReadonly } from '../readonly/index';
|
|
19
21
|
import { type TRecordOrObject } from '../record/index';
|
|
20
22
|
import { type TRef } from '../ref/index';
|
|
21
23
|
import { TRequired } from '../required/index';
|
|
@@ -44,7 +46,7 @@ type TFromArray<ModuleProperties extends TProperties, Type extends TSchema> = (E
|
|
|
44
46
|
type TFromAsyncIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TAsyncIterator<TFromType<ModuleProperties, Type>>);
|
|
45
47
|
type TFromIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TIterator<TFromType<ModuleProperties, Type>>);
|
|
46
48
|
type TFromRest<ModuleProperties extends TProperties, Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest<ModuleProperties, Right, [...Result, TFromType<ModuleProperties, Left>]> : Result);
|
|
47
|
-
export type TFromType<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TArray<infer Type extends TSchema> ? TFromArray<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator<ModuleProperties, Type> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<ModuleProperties, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<ModuleProperties, Properties> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Type : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<ModuleProperties, Types> : Type);
|
|
49
|
+
export type TFromType<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TOptional<infer Type extends TSchema> ? TOptional<TFromType<ModuleProperties, Type>> : Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TFromType<ModuleProperties, Type>> : Type extends TArray<infer Type extends TSchema> ? TFromArray<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator<ModuleProperties, Type> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<ModuleProperties, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<ModuleProperties, Properties> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Type : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<ModuleProperties, Types> : Type);
|
|
48
50
|
export declare function FromType<ModuleProperties extends TProperties, Type extends TSchema>(moduleProperties: ModuleProperties, type: Type): TFromType<ModuleProperties, Type>;
|
|
49
51
|
export type TComputeType<ModuleProperties extends TProperties, Key extends PropertyKey> = (Key extends keyof ModuleProperties ? TFromType<ModuleProperties, ModuleProperties[Key]> : TNever);
|
|
50
52
|
export declare function ComputeType<ModuleProperties extends TProperties, Key extends PropertyKey>(moduleProperties: ModuleProperties, key: Key): TComputeType<ModuleProperties, Key>;
|
|
@@ -5,24 +5,26 @@ exports.FromType = FromType;
|
|
|
5
5
|
exports.ComputeType = ComputeType;
|
|
6
6
|
exports.ComputeModuleProperties = ComputeModuleProperties;
|
|
7
7
|
const index_1 = require("../create/index");
|
|
8
|
-
const index_2 = require("../
|
|
9
|
-
const index_3 = require("../
|
|
10
|
-
const index_4 = require("../
|
|
11
|
-
const index_5 = require("../
|
|
12
|
-
const index_6 = require("../
|
|
13
|
-
const index_7 = require("../
|
|
14
|
-
const index_8 = require("../
|
|
15
|
-
const index_9 = require("../
|
|
16
|
-
const index_10 = require("../
|
|
17
|
-
const index_11 = require("../
|
|
18
|
-
const index_12 = require("../
|
|
19
|
-
const index_13 = require("../
|
|
20
|
-
const index_14 = require("../
|
|
21
|
-
const index_15 = require("../
|
|
22
|
-
const index_16 = require("../
|
|
23
|
-
const index_17 = require("../
|
|
24
|
-
const index_18 = require("../
|
|
25
|
-
const index_19 = require("../
|
|
8
|
+
const index_2 = require("../discard/index");
|
|
9
|
+
const index_3 = require("../array/index");
|
|
10
|
+
const index_4 = require("../awaited/index");
|
|
11
|
+
const index_5 = require("../async-iterator/index");
|
|
12
|
+
const index_6 = require("../constructor/index");
|
|
13
|
+
const index_7 = require("../indexed/index");
|
|
14
|
+
const index_8 = require("../function/index");
|
|
15
|
+
const index_9 = require("../intersect/index");
|
|
16
|
+
const index_10 = require("../iterator/index");
|
|
17
|
+
const index_11 = require("../keyof/index");
|
|
18
|
+
const index_12 = require("../object/index");
|
|
19
|
+
const index_13 = require("../omit/index");
|
|
20
|
+
const index_14 = require("../pick/index");
|
|
21
|
+
const index_15 = require("../never/index");
|
|
22
|
+
const index_16 = require("../partial/index");
|
|
23
|
+
const index_17 = require("../record/index");
|
|
24
|
+
const index_18 = require("../required/index");
|
|
25
|
+
const index_19 = require("../tuple/index");
|
|
26
|
+
const index_20 = require("../union/index");
|
|
27
|
+
const index_21 = require("../symbols/index");
|
|
26
28
|
// ------------------------------------------------------------------
|
|
27
29
|
// KindGuard
|
|
28
30
|
// ------------------------------------------------------------------
|
|
@@ -41,39 +43,39 @@ function Deref(moduleProperties, ref) {
|
|
|
41
43
|
? KindGuard.IsRef(moduleProperties[ref])
|
|
42
44
|
? Deref(moduleProperties, moduleProperties[ref].$ref)
|
|
43
45
|
: FromType(moduleProperties, moduleProperties[ref])
|
|
44
|
-
: (0,
|
|
46
|
+
: (0, index_15.Never)());
|
|
45
47
|
}
|
|
46
48
|
// prettier-ignore
|
|
47
49
|
function FromAwaited(parameters) {
|
|
48
|
-
return (0,
|
|
50
|
+
return (0, index_4.Awaited)(parameters[0]);
|
|
49
51
|
}
|
|
50
52
|
// prettier-ignore
|
|
51
53
|
function FromIndex(parameters) {
|
|
52
|
-
return (0,
|
|
54
|
+
return (0, index_7.Index)(parameters[0], parameters[1]);
|
|
53
55
|
}
|
|
54
56
|
// prettier-ignore
|
|
55
57
|
function FromKeyOf(parameters) {
|
|
56
|
-
return (0,
|
|
58
|
+
return (0, index_11.KeyOf)(parameters[0]);
|
|
57
59
|
}
|
|
58
60
|
// prettier-ignore
|
|
59
61
|
function FromPartial(parameters) {
|
|
60
|
-
return (0,
|
|
62
|
+
return (0, index_16.Partial)(parameters[0]);
|
|
61
63
|
}
|
|
62
64
|
// prettier-ignore
|
|
63
65
|
function FromOmit(parameters) {
|
|
64
|
-
return (0,
|
|
66
|
+
return (0, index_13.Omit)(parameters[0], parameters[1]);
|
|
65
67
|
}
|
|
66
68
|
// prettier-ignore
|
|
67
69
|
function FromPick(parameters) {
|
|
68
|
-
return (0,
|
|
70
|
+
return (0, index_14.Pick)(parameters[0], parameters[1]);
|
|
69
71
|
}
|
|
70
72
|
// prettier-ignore
|
|
71
73
|
function FromRecord(parameters) {
|
|
72
|
-
return (0,
|
|
74
|
+
return (0, index_17.Record)(parameters[0], parameters[1]);
|
|
73
75
|
}
|
|
74
76
|
// prettier-ignore
|
|
75
77
|
function FromRequired(parameters) {
|
|
76
|
-
return (0,
|
|
78
|
+
return (0, index_18.Required)(parameters[0]);
|
|
77
79
|
}
|
|
78
80
|
// prettier-ignore
|
|
79
81
|
function FromComputed(moduleProperties, target, parameters) {
|
|
@@ -86,64 +88,69 @@ function FromComputed(moduleProperties, target, parameters) {
|
|
|
86
88
|
target === 'Pick' ? FromPick(dereferenced) :
|
|
87
89
|
target === 'Record' ? FromRecord(dereferenced) :
|
|
88
90
|
target === 'Required' ? FromRequired(dereferenced) :
|
|
89
|
-
(0,
|
|
91
|
+
(0, index_15.Never)());
|
|
90
92
|
}
|
|
91
93
|
function FromObject(moduleProperties, properties) {
|
|
92
|
-
return (0,
|
|
94
|
+
return (0, index_12.Object)(globalThis.Object.keys(properties).reduce((result, key) => {
|
|
93
95
|
return { ...result, [key]: FromType(moduleProperties, properties[key]) };
|
|
94
96
|
}, {}));
|
|
95
97
|
}
|
|
96
98
|
// prettier-ignore
|
|
97
99
|
function FromConstructor(moduleProperties, parameters, instanceType) {
|
|
98
|
-
return (0,
|
|
100
|
+
return (0, index_6.Constructor)(FromRest(moduleProperties, parameters), FromType(moduleProperties, instanceType));
|
|
99
101
|
}
|
|
100
102
|
// prettier-ignore
|
|
101
103
|
function FromFunction(moduleProperties, parameters, returnType) {
|
|
102
|
-
return (0,
|
|
104
|
+
return (0, index_8.Function)(FromRest(moduleProperties, parameters), FromType(moduleProperties, returnType));
|
|
103
105
|
}
|
|
104
106
|
function FromTuple(moduleProperties, types) {
|
|
105
|
-
return (0,
|
|
107
|
+
return (0, index_19.Tuple)(FromRest(moduleProperties, types));
|
|
106
108
|
}
|
|
107
109
|
function FromIntersect(moduleProperties, types) {
|
|
108
|
-
return (0,
|
|
110
|
+
return (0, index_9.Intersect)(FromRest(moduleProperties, types));
|
|
109
111
|
}
|
|
110
112
|
function FromUnion(moduleProperties, types) {
|
|
111
|
-
return (0,
|
|
113
|
+
return (0, index_20.Union)(FromRest(moduleProperties, types));
|
|
112
114
|
}
|
|
113
115
|
function FromArray(moduleProperties, type) {
|
|
114
|
-
return (0,
|
|
116
|
+
return (0, index_3.Array)(FromType(moduleProperties, type));
|
|
115
117
|
}
|
|
116
118
|
function FromAsyncIterator(moduleProperties, type) {
|
|
117
|
-
return (0,
|
|
119
|
+
return (0, index_5.AsyncIterator)(FromType(moduleProperties, type));
|
|
118
120
|
}
|
|
119
121
|
function FromIterator(moduleProperties, type) {
|
|
120
|
-
return (0,
|
|
122
|
+
return (0, index_10.Iterator)(FromType(moduleProperties, type));
|
|
121
123
|
}
|
|
122
124
|
function FromRest(moduleProperties, types) {
|
|
123
125
|
return types.map((type) => FromType(moduleProperties, type));
|
|
124
126
|
}
|
|
125
127
|
// prettier-ignore
|
|
126
128
|
function FromType(moduleProperties, type) {
|
|
127
|
-
return (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
KindGuard.
|
|
133
|
-
KindGuard.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
129
|
+
return (
|
|
130
|
+
// Modifier Unwrap - Reapplied via CreateType Options
|
|
131
|
+
KindGuard.IsOptional(type) ? (0, index_1.CreateType)(FromType(moduleProperties, (0, index_2.Discard)(type, [index_21.OptionalKind])), type) :
|
|
132
|
+
KindGuard.IsReadonly(type) ? (0, index_1.CreateType)(FromType(moduleProperties, (0, index_2.Discard)(type, [index_21.ReadonlyKind])), type) :
|
|
133
|
+
// Traveral
|
|
134
|
+
KindGuard.IsArray(type) ? (0, index_1.CreateType)(FromArray(moduleProperties, type.items), type) :
|
|
135
|
+
KindGuard.IsAsyncIterator(type) ? (0, index_1.CreateType)(FromAsyncIterator(moduleProperties, type.items), type) :
|
|
136
|
+
// Note: The 'as never' is required due to excessive resolution of TIndex. In fact TIndex, TPick, TOmit and
|
|
137
|
+
// all need re-implementation to remove the PropertyKey[] selector. Reimplementation of these types should
|
|
138
|
+
// be a priority as there is a potential for the current inference to break on TS compiler changes.
|
|
139
|
+
KindGuard.IsComputed(type) ? (0, index_1.CreateType)(FromComputed(moduleProperties, type.target, type.parameters)) :
|
|
140
|
+
KindGuard.IsConstructor(type) ? (0, index_1.CreateType)(FromConstructor(moduleProperties, type.parameters, type.returns), type) :
|
|
141
|
+
KindGuard.IsFunction(type) ? (0, index_1.CreateType)(FromFunction(moduleProperties, type.parameters, type.returns), type) :
|
|
142
|
+
KindGuard.IsIntersect(type) ? (0, index_1.CreateType)(FromIntersect(moduleProperties, type.allOf), type) :
|
|
143
|
+
KindGuard.IsIterator(type) ? (0, index_1.CreateType)(FromIterator(moduleProperties, type.items), type) :
|
|
144
|
+
KindGuard.IsObject(type) ? (0, index_1.CreateType)(FromObject(moduleProperties, type.properties), type) :
|
|
145
|
+
KindGuard.IsTuple(type) ? (0, index_1.CreateType)(FromTuple(moduleProperties, type.items || []), type) :
|
|
146
|
+
KindGuard.IsUnion(type) ? (0, index_1.CreateType)(FromUnion(moduleProperties, type.anyOf), type) :
|
|
147
|
+
type);
|
|
141
148
|
}
|
|
142
149
|
// prettier-ignore
|
|
143
150
|
function ComputeType(moduleProperties, key) {
|
|
144
151
|
return (key in moduleProperties
|
|
145
152
|
? FromType(moduleProperties, moduleProperties[key])
|
|
146
|
-
: (0,
|
|
153
|
+
: (0, index_15.Never)());
|
|
147
154
|
}
|
|
148
155
|
// prettier-ignore
|
|
149
156
|
function ComputeModuleProperties(moduleProperties) {
|
|
@@ -13,9 +13,11 @@ import { type TIterator } from '../iterator/index.mjs';
|
|
|
13
13
|
import { type TKeyOf } from '../keyof/index.mjs';
|
|
14
14
|
import { type TObject, type TProperties } from '../object/index.mjs';
|
|
15
15
|
import { type TOmit } from '../omit/index.mjs';
|
|
16
|
+
import { type TOptional } from '../optional/index.mjs';
|
|
16
17
|
import { type TPick } from '../pick/index.mjs';
|
|
17
18
|
import { type TNever } from '../never/index.mjs';
|
|
18
19
|
import { TPartial } from '../partial/index.mjs';
|
|
20
|
+
import { type TReadonly } from '../readonly/index.mjs';
|
|
19
21
|
import { type TRecordOrObject } from '../record/index.mjs';
|
|
20
22
|
import { type TRef } from '../ref/index.mjs';
|
|
21
23
|
import { TRequired } from '../required/index.mjs';
|
|
@@ -44,7 +46,7 @@ type TFromArray<ModuleProperties extends TProperties, Type extends TSchema> = (E
|
|
|
44
46
|
type TFromAsyncIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TAsyncIterator<TFromType<ModuleProperties, Type>>);
|
|
45
47
|
type TFromIterator<ModuleProperties extends TProperties, Type extends TSchema> = (TIterator<TFromType<ModuleProperties, Type>>);
|
|
46
48
|
type TFromRest<ModuleProperties extends TProperties, Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest<ModuleProperties, Right, [...Result, TFromType<ModuleProperties, Left>]> : Result);
|
|
47
|
-
export type TFromType<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TArray<infer Type extends TSchema> ? TFromArray<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator<ModuleProperties, Type> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<ModuleProperties, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<ModuleProperties, Properties> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Type : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<ModuleProperties, Types> : Type);
|
|
49
|
+
export type TFromType<ModuleProperties extends TProperties, Type extends TSchema> = (Type extends TOptional<infer Type extends TSchema> ? TOptional<TFromType<ModuleProperties, Type>> : Type extends TReadonly<infer Type extends TSchema> ? TReadonly<TFromType<ModuleProperties, Type>> : Type extends TArray<infer Type extends TSchema> ? TFromArray<ModuleProperties, Type> : Type extends TAsyncIterator<infer Type extends TSchema> ? TFromAsyncIterator<ModuleProperties, Type> : Type extends TComputed<infer Target extends string, infer Parameters extends TSchema[]> ? TFromComputed<ModuleProperties, Target, Parameters> : Type extends TConstructor<infer Parameters extends TSchema[], infer InstanceType extends TSchema> ? TFromConstructor<ModuleProperties, Parameters, InstanceType> : Type extends TFunction<infer Parameters extends TSchema[], infer ReturnType extends TSchema> ? TFromFunction<ModuleProperties, Parameters, ReturnType> : Type extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<ModuleProperties, Types> : Type extends TIterator<infer Type extends TSchema> ? TFromIterator<ModuleProperties, Type> : Type extends TObject<infer Properties extends TProperties> ? TFromObject<ModuleProperties, Properties> : Type extends TTuple<infer Types extends TSchema[]> ? TFromTuple<ModuleProperties, Types> : Type extends TEnum<infer _ extends TEnumRecord> ? Type : Type extends TUnion<infer Types extends TSchema[]> ? TFromUnion<ModuleProperties, Types> : Type);
|
|
48
50
|
export declare function FromType<ModuleProperties extends TProperties, Type extends TSchema>(moduleProperties: ModuleProperties, type: Type): TFromType<ModuleProperties, Type>;
|
|
49
51
|
export type TComputeType<ModuleProperties extends TProperties, Key extends PropertyKey> = (Key extends keyof ModuleProperties ? TFromType<ModuleProperties, ModuleProperties[Key]> : TNever);
|
|
50
52
|
export declare function ComputeType<ModuleProperties extends TProperties, Key extends PropertyKey>(moduleProperties: ModuleProperties, key: Key): TComputeType<ModuleProperties, Key>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CreateType } from '../create/index.mjs';
|
|
2
|
+
import { Discard } from '../discard/index.mjs';
|
|
2
3
|
import { Array } from '../array/index.mjs';
|
|
3
4
|
import { Awaited } from '../awaited/index.mjs';
|
|
4
5
|
import { AsyncIterator } from '../async-iterator/index.mjs';
|
|
@@ -17,6 +18,7 @@ import { Record } from '../record/index.mjs';
|
|
|
17
18
|
import { Required } from '../required/index.mjs';
|
|
18
19
|
import { Tuple } from '../tuple/index.mjs';
|
|
19
20
|
import { Union } from '../union/index.mjs';
|
|
21
|
+
import { OptionalKind, ReadonlyKind } from '../symbols/index.mjs';
|
|
20
22
|
// ------------------------------------------------------------------
|
|
21
23
|
// KindGuard
|
|
22
24
|
// ------------------------------------------------------------------
|
|
@@ -118,20 +120,25 @@ function FromRest(moduleProperties, types) {
|
|
|
118
120
|
}
|
|
119
121
|
// prettier-ignore
|
|
120
122
|
export function FromType(moduleProperties, type) {
|
|
121
|
-
return (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
KindGuard.
|
|
127
|
-
KindGuard.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
return (
|
|
124
|
+
// Modifier Unwrap - Reapplied via CreateType Options
|
|
125
|
+
KindGuard.IsOptional(type) ? CreateType(FromType(moduleProperties, Discard(type, [OptionalKind])), type) :
|
|
126
|
+
KindGuard.IsReadonly(type) ? CreateType(FromType(moduleProperties, Discard(type, [ReadonlyKind])), type) :
|
|
127
|
+
// Traveral
|
|
128
|
+
KindGuard.IsArray(type) ? CreateType(FromArray(moduleProperties, type.items), type) :
|
|
129
|
+
KindGuard.IsAsyncIterator(type) ? CreateType(FromAsyncIterator(moduleProperties, type.items), type) :
|
|
130
|
+
// Note: The 'as never' is required due to excessive resolution of TIndex. In fact TIndex, TPick, TOmit and
|
|
131
|
+
// all need re-implementation to remove the PropertyKey[] selector. Reimplementation of these types should
|
|
132
|
+
// be a priority as there is a potential for the current inference to break on TS compiler changes.
|
|
133
|
+
KindGuard.IsComputed(type) ? CreateType(FromComputed(moduleProperties, type.target, type.parameters)) :
|
|
134
|
+
KindGuard.IsConstructor(type) ? CreateType(FromConstructor(moduleProperties, type.parameters, type.returns), type) :
|
|
135
|
+
KindGuard.IsFunction(type) ? CreateType(FromFunction(moduleProperties, type.parameters, type.returns), type) :
|
|
136
|
+
KindGuard.IsIntersect(type) ? CreateType(FromIntersect(moduleProperties, type.allOf), type) :
|
|
137
|
+
KindGuard.IsIterator(type) ? CreateType(FromIterator(moduleProperties, type.items), type) :
|
|
138
|
+
KindGuard.IsObject(type) ? CreateType(FromObject(moduleProperties, type.properties), type) :
|
|
139
|
+
KindGuard.IsTuple(type) ? CreateType(FromTuple(moduleProperties, type.items || []), type) :
|
|
140
|
+
KindGuard.IsUnion(type) ? CreateType(FromUnion(moduleProperties, type.anyOf), type) :
|
|
141
|
+
type);
|
|
135
142
|
}
|
|
136
143
|
// prettier-ignore
|
|
137
144
|
export function ComputeType(moduleProperties, key) {
|