arktype 2.0.0-rc.0 → 2.0.0-rc.10
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.
- package/out/config.d.ts +1 -1
- package/out/generic.d.ts +55 -53
- package/out/generic.js +9 -11
- package/out/index.d.ts +5 -5
- package/out/index.js +3 -2
- package/out/keywords/{builtin.d.ts → builtins.d.ts} +9 -5
- package/out/keywords/{builtin.js → builtins.js} +2 -2
- package/out/keywords/constructors/Array.d.ts +12 -8
- package/out/keywords/constructors/Array.js +7 -7
- package/out/keywords/constructors/Date.d.ts +32 -0
- package/out/keywords/constructors/FormData.d.ts +12 -6
- package/out/keywords/constructors/FormData.js +19 -6
- package/out/keywords/constructors/TypedArray.d.ts +18 -14
- package/out/keywords/constructors/TypedArray.js +2 -2
- package/out/keywords/constructors/constructors.d.ts +21 -32
- package/out/keywords/constructors/constructors.js +13 -28
- package/out/keywords/inference.d.ts +227 -0
- package/out/keywords/keywords.d.ts +61 -0
- package/out/keywords/keywords.js +26 -0
- package/out/keywords/number/epoch.d.ts +1 -2
- package/out/keywords/number/epoch.js +2 -2
- package/out/keywords/number/integer.js +2 -2
- package/out/keywords/number/number.d.ts +37 -9
- package/out/keywords/number/number.js +17 -5
- package/out/keywords/string/alpha.d.ts +1 -1
- package/out/keywords/string/alphanumeric.d.ts +1 -1
- package/out/keywords/string/capitalize.d.ts +11 -10
- package/out/keywords/string/capitalize.js +4 -4
- package/out/keywords/string/creditCard.d.ts +1 -1
- package/out/keywords/string/creditCard.js +2 -2
- package/out/keywords/string/date.d.ts +27 -26
- package/out/keywords/string/date.js +16 -16
- package/out/keywords/string/digits.d.ts +1 -1
- package/out/keywords/string/email.d.ts +1 -1
- package/out/keywords/string/integer.d.ts +11 -10
- package/out/keywords/string/integer.js +7 -7
- package/out/keywords/string/ip.d.ts +12 -12
- package/out/keywords/string/ip.js +5 -5
- package/out/keywords/string/json.d.ts +12 -10
- package/out/keywords/string/json.js +24 -16
- package/out/keywords/string/lower.d.ts +11 -10
- package/out/keywords/string/lower.js +4 -4
- package/out/keywords/string/normalize.d.ts +63 -47
- package/out/keywords/string/normalize.js +14 -14
- package/out/keywords/string/numeric.d.ts +11 -10
- package/out/keywords/string/numeric.js +7 -7
- package/out/keywords/string/semver.d.ts +1 -1
- package/out/keywords/string/string.d.ts +78 -26
- package/out/keywords/string/string.js +5 -5
- package/out/keywords/string/trim.d.ts +11 -10
- package/out/keywords/string/trim.js +4 -4
- package/out/keywords/string/upper.d.ts +11 -10
- package/out/keywords/string/upper.js +4 -4
- package/out/keywords/string/url.d.ts +11 -10
- package/out/keywords/string/url.js +8 -8
- package/out/keywords/string/uuid.d.ts +27 -23
- package/out/keywords/string/uuid.js +3 -3
- package/out/keywords/ts.d.ts +44 -22
- package/out/keywords/ts.js +20 -14
- package/out/keywords/utils.d.ts +1 -1
- package/out/keywords/utils.js +1 -1
- package/out/{subtypes → methods}/array.d.ts +6 -6
- package/out/methods/base.d.ts +96 -0
- package/out/{subtypes → methods}/date.d.ts +5 -5
- package/out/{subtypes → methods}/instantiate.d.ts +5 -4
- package/out/methods/morph.d.ts +12 -0
- package/out/{subtypes → methods}/number.d.ts +6 -6
- package/out/methods/object.d.ts +81 -0
- package/out/{subtypes → methods}/string.d.ts +7 -7
- package/out/{subtypes → methods}/validator.d.ts +2 -2
- package/out/module.d.ts +2 -2
- package/out/parser/{semantic → ast}/bounds.d.ts +6 -4
- package/out/parser/ast/default.d.ts +8 -0
- package/out/parser/ast/infer.d.ts +39 -0
- package/out/parser/ast/utils.d.ts +4 -0
- package/out/parser/ast/validate.d.ts +26 -0
- package/out/parser/definition.d.ts +9 -12
- package/out/parser/objectLiteral.d.ts +11 -25
- package/out/parser/objectLiteral.js +6 -24
- package/out/parser/{string/reduce → reduce}/dynamic.d.ts +5 -7
- package/out/parser/{string/reduce → reduce}/dynamic.js +5 -6
- package/out/parser/{string/reduce → reduce}/shared.d.ts +1 -1
- package/out/parser/{string/reduce → reduce}/static.d.ts +1 -1
- package/out/parser/{string/shift → shift}/operand/date.d.ts +3 -1
- package/out/parser/{string/shift → shift}/operand/enclosed.d.ts +4 -1
- package/out/parser/{string/shift → shift}/operand/enclosed.js +7 -3
- package/out/parser/{string/shift → shift}/operand/unenclosed.d.ts +7 -8
- package/out/parser/{string/shift → shift}/operand/unenclosed.js +7 -3
- package/out/parser/{string/shift → shift}/operator/bounds.d.ts +7 -6
- package/out/parser/{string/shift → shift}/operator/default.d.ts +3 -6
- package/out/parser/{string/shift → shift}/operator/default.js +1 -6
- package/out/parser/{string/shift → shift}/operator/operator.js +2 -2
- package/out/parser/{string/shift → shift}/scanner.d.ts +6 -2
- package/out/parser/{string/shift → shift}/scanner.js +7 -5
- package/out/parser/{string/string.d.ts → string.d.ts} +8 -8
- package/out/parser/{string/string.js → string.js} +2 -0
- package/out/parser/tuple.d.ts +54 -43
- package/out/parser/tuple.js +36 -30
- package/out/scope.d.ts +41 -34
- package/out/scope.js +48 -27
- package/out/type.d.ts +25 -20
- package/out/type.js +23 -14
- package/package.json +3 -3
- package/out/intersect.d.ts +0 -28
- package/out/keys.d.ts +0 -16
- package/out/keywords/ark.d.ts +0 -33
- package/out/keywords/ark.js +0 -18
- package/out/keywords/ast.d.ts +0 -193
- package/out/parser/semantic/default.d.ts +0 -8
- package/out/parser/semantic/default.js +0 -1
- package/out/parser/semantic/infer.d.ts +0 -33
- package/out/parser/semantic/utils.d.ts +0 -4
- package/out/parser/semantic/validate.d.ts +0 -29
- package/out/subtypes/base.d.ts +0 -84
- package/out/subtypes/morph.d.ts +0 -13
- package/out/subtypes/object.d.ts +0 -33
- /package/out/{intersect.js → keywords/constructors/Date.js} +0 -0
- /package/out/keywords/{ast.js → inference.js} +0 -0
- /package/out/{subtypes → methods}/array.js +0 -0
- /package/out/{subtypes → methods}/base.js +0 -0
- /package/out/{subtypes → methods}/date.js +0 -0
- /package/out/{subtypes → methods}/instantiate.js +0 -0
- /package/out/{subtypes → methods}/morph.js +0 -0
- /package/out/{subtypes → methods}/number.js +0 -0
- /package/out/{subtypes → methods}/object.js +0 -0
- /package/out/{subtypes → methods}/string.js +0 -0
- /package/out/{subtypes → methods}/validator.js +0 -0
- /package/out/parser/{semantic → ast}/bounds.js +0 -0
- /package/out/{keys.js → parser/ast/default.js} +0 -0
- /package/out/parser/{semantic → ast}/divisor.d.ts +0 -0
- /package/out/parser/{semantic → ast}/divisor.js +0 -0
- /package/out/parser/{semantic → ast}/infer.js +0 -0
- /package/out/parser/{semantic → ast}/keyof.d.ts +0 -0
- /package/out/parser/{semantic → ast}/keyof.js +0 -0
- /package/out/parser/{semantic → ast}/utils.js +0 -0
- /package/out/parser/{semantic → ast}/validate.js +0 -0
- /package/out/parser/{string/reduce → reduce}/shared.js +0 -0
- /package/out/parser/{string/reduce → reduce}/static.js +0 -0
- /package/out/parser/{string/shift → shift}/operand/date.js +0 -0
- /package/out/parser/{string/shift → shift}/operand/genericArgs.d.ts +0 -0
- /package/out/parser/{string/shift → shift}/operand/genericArgs.js +0 -0
- /package/out/parser/{string/shift → shift}/operand/operand.d.ts +0 -0
- /package/out/parser/{string/shift → shift}/operand/operand.js +0 -0
- /package/out/parser/{string/shift → shift}/operator/bounds.js +0 -0
- /package/out/parser/{string/shift → shift}/operator/divisor.d.ts +0 -0
- /package/out/parser/{string/shift → shift}/operator/divisor.js +0 -0
- /package/out/parser/{string/shift → shift}/operator/operator.d.ts +0 -0
package/out/keywords/ast.d.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import type { ArkError, ArkErrors, Constraint, constraintKindOf, Morph, NodeSchema } from "@ark/schema";
|
|
2
|
-
import { type anyOrNever, type array, type conform, type equals, type leftIfEqual, type Primitive, type show } from "@ark/util";
|
|
3
|
-
import type { inferPipe } from "../intersect.ts";
|
|
4
|
-
import type { Type } from "../type.ts";
|
|
5
|
-
import type { type } from "./ark.ts";
|
|
6
|
-
import type { arkPrototypes } from "./constructors/constructors.ts";
|
|
7
|
-
import type { number } from "./number/number.ts";
|
|
8
|
-
import type { string } from "./string/string.ts";
|
|
9
|
-
export type { arkPrototypes as object } from "./constructors/constructors.ts";
|
|
10
|
-
export type { number } from "./number/number.ts";
|
|
11
|
-
export type { string } from "./string/string.ts";
|
|
12
|
-
export type Comparator = "<" | "<=" | ">" | ">=" | "==";
|
|
13
|
-
export type RegexLiteral<source extends string = string> = `/${source}/`;
|
|
14
|
-
export type DateLiteral<source extends string = string> = `d"${source}"` | `d'${source}'`;
|
|
15
|
-
export type ConstraintSet = Record<PropertyKey, 1>;
|
|
16
|
-
export type Constraints = Record<string, ConstraintSet>;
|
|
17
|
-
export declare const constrained: " arkConstrained";
|
|
18
|
-
export type constrained = typeof constrained;
|
|
19
|
-
export type constrain<base, constraints extends Constraints> = base & {
|
|
20
|
-
[constrained]: constraints;
|
|
21
|
-
};
|
|
22
|
-
export type LimitLiteral = number | DateLiteral;
|
|
23
|
-
export type normalizeLimit<limit> = limit extends DateLiteral<infer source> ? source : limit extends number | string ? limit : never;
|
|
24
|
-
type constraint<rule> = {
|
|
25
|
-
[k in rule & PropertyKey]: 1;
|
|
26
|
-
};
|
|
27
|
-
export type AtLeast<rule> = {
|
|
28
|
-
atLeast: constraint<rule>;
|
|
29
|
-
};
|
|
30
|
-
export type AtMost<rule> = {
|
|
31
|
-
atMost: constraint<rule>;
|
|
32
|
-
};
|
|
33
|
-
export type MoreThan<rule> = {
|
|
34
|
-
moreThan: constraint<rule>;
|
|
35
|
-
};
|
|
36
|
-
export type LessThan<rule> = {
|
|
37
|
-
lessThan: constraint<rule>;
|
|
38
|
-
};
|
|
39
|
-
export type Literal<rule> = {
|
|
40
|
-
literal: constraint<rule>;
|
|
41
|
-
};
|
|
42
|
-
export type DivisibleBy<rule> = {
|
|
43
|
-
divisibleBy: constraint<rule>;
|
|
44
|
-
};
|
|
45
|
-
export type Length<rule> = {
|
|
46
|
-
length: constraint<rule>;
|
|
47
|
-
};
|
|
48
|
-
export type Matching<rule> = {
|
|
49
|
-
matching: constraint<rule>;
|
|
50
|
-
};
|
|
51
|
-
export type Narrowed = {
|
|
52
|
-
predicate: {
|
|
53
|
-
[k in "?"]: 1;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export type Branded<rule> = {
|
|
57
|
-
predicate: constraint<rule>;
|
|
58
|
-
};
|
|
59
|
-
export type primitiveConstraintKindOf<In> = Extract<Constraint.PrimitiveKind, constraintKindOf<In>>;
|
|
60
|
-
export type AtLeastLength<rule> = {
|
|
61
|
-
atLeastLength: constraint<rule>;
|
|
62
|
-
};
|
|
63
|
-
export type AtMostLength<rule> = {
|
|
64
|
-
atMostLength: constraint<rule>;
|
|
65
|
-
};
|
|
66
|
-
export type MoreThanLength<rule> = {
|
|
67
|
-
moreThanLength: constraint<rule>;
|
|
68
|
-
};
|
|
69
|
-
export type LessThanLength<rule> = {
|
|
70
|
-
lessThanLength: constraint<rule>;
|
|
71
|
-
};
|
|
72
|
-
export type ExactlyLength<rule> = {
|
|
73
|
-
atLeastLength: constraint<rule>;
|
|
74
|
-
atMostLength: constraint<rule>;
|
|
75
|
-
};
|
|
76
|
-
export type AtOrAfter<rule> = {
|
|
77
|
-
atOrAfter: constraint<rule>;
|
|
78
|
-
};
|
|
79
|
-
export type AtOrBefore<rule> = {
|
|
80
|
-
atOrBefore: constraint<rule>;
|
|
81
|
-
};
|
|
82
|
-
export type After<rule> = {
|
|
83
|
-
after: constraint<rule>;
|
|
84
|
-
};
|
|
85
|
-
export type Before<rule> = {
|
|
86
|
-
before: constraint<rule>;
|
|
87
|
-
};
|
|
88
|
-
export declare namespace Date {
|
|
89
|
-
type atOrAfter<rule> = constrain<Date, AtOrAfter<rule>>;
|
|
90
|
-
type after<rule> = constrain<Date, After<rule>>;
|
|
91
|
-
type atOrBefore<rule> = constrain<Date, AtOrBefore<rule>>;
|
|
92
|
-
type before<rule> = constrain<Date, Before<rule>>;
|
|
93
|
-
type narrowed = constrain<Date, Narrowed>;
|
|
94
|
-
type branded<rule> = constrain<Date, Branded<rule>>;
|
|
95
|
-
type literal<rule> = constrain<Date, Literal<rule>>;
|
|
96
|
-
type is<constraints extends Constraints> = constrain<Date, constraints>;
|
|
97
|
-
type parseConstraint<kind extends Constraint.PrimitiveKind, schema extends NodeSchema<kind>> = normalizePrimitiveConstraintRoot<schema> extends infer rule ? kind extends "after" ? schema extends {
|
|
98
|
-
exclusive: true;
|
|
99
|
-
} ? after<normalizeLimit<rule>> : atOrAfter<normalizeLimit<rule>> : kind extends "before" ? schema extends {
|
|
100
|
-
exclusive: true;
|
|
101
|
-
} ? before<normalizeLimit<rule>> : atOrBefore<normalizeLimit<rule>> : narrowed : never;
|
|
102
|
-
}
|
|
103
|
-
export type applyConstraint<t, kind extends Constraint.PrimitiveKind, schema extends NodeSchema<kind>> = t extends MorphAst<infer i, infer o> ? (In: leftIfEqual<i, _applyConstraint<i, kind, schema>>) => o : leftIfEqual<t, _applyConstraint<t, kind, schema>>;
|
|
104
|
-
type _applyConstraint<t, kind extends Constraint.PrimitiveKind, schema extends NodeSchema<kind>> = schemaToConstraint<kind, schema> extends infer constraint ? parseConstraints<t> extends ([
|
|
105
|
-
infer base,
|
|
106
|
-
infer constraints extends Constraints
|
|
107
|
-
]) ? [
|
|
108
|
-
number,
|
|
109
|
-
base
|
|
110
|
-
] extends [base, number] ? number.is<constraint & constraints> : [string, base] extends [base, string] ? string.is<constraint & constraints> : [Date, base] extends [base, Date] ? Date.is<constraint & constraints> : constrain<base, constraints & constraint> : [number, t] extends [t, number] ? number.parseConstraint<kind, schema> : [string, t] extends [t, string] ? string.parseConstraint<kind, schema> : [Date, t] extends [t, Date] ? Date.parseConstraint<kind, schema> : constrain<t, conform<constraint, Constraints>> : never;
|
|
111
|
-
export type parseConstraints<t> = t extends constrain<infer base, infer constraints> ? equals<t, number & {
|
|
112
|
-
[constrained]: constraints;
|
|
113
|
-
}> extends true ? [
|
|
114
|
-
number,
|
|
115
|
-
constraints
|
|
116
|
-
] : equals<t, string & {
|
|
117
|
-
[constrained]: constraints;
|
|
118
|
-
}> extends true ? [
|
|
119
|
-
string,
|
|
120
|
-
constraints
|
|
121
|
-
] : equals<t, Date & {
|
|
122
|
-
[constrained]: constraints;
|
|
123
|
-
}> extends true ? [
|
|
124
|
-
Date,
|
|
125
|
-
constraints
|
|
126
|
-
] : [base, constraints] : null;
|
|
127
|
-
export type normalizePrimitiveConstraintRoot<schema extends NodeSchema<Constraint.PrimitiveKind>> = "rule" extends keyof schema ? conform<schema["rule"], PropertyKey> : conform<schema, PropertyKey>;
|
|
128
|
-
export type schemaToConstraint<kind extends Constraint.PrimitiveKind, schema extends NodeSchema<kind>> = normalizePrimitiveConstraintRoot<schema> extends infer rule ? kind extends "pattern" ? Matching<rule> : kind extends "divisor" ? DivisibleBy<rule> : kind extends "exactLength" ? Length<rule> : kind extends "min" ? schema extends {
|
|
129
|
-
exclusive: true;
|
|
130
|
-
} ? MoreThan<rule> : AtLeast<rule> : kind extends "max" ? schema extends {
|
|
131
|
-
exclusive: true;
|
|
132
|
-
} ? LessThan<rule> : AtMost<rule> : kind extends "minLength" ? schema extends {
|
|
133
|
-
exclusive: true;
|
|
134
|
-
} ? MoreThanLength<rule> : AtLeastLength<rule> : kind extends "maxLength" ? schema extends {
|
|
135
|
-
exclusive: true;
|
|
136
|
-
} ? LessThanLength<rule> : AtMostLength<rule> : kind extends "exactLength" ? ExactlyLength<rule> : kind extends "after" ? schema extends {
|
|
137
|
-
exclusive: true;
|
|
138
|
-
} ? After<normalizeLimit<rule>> : AtOrAfter<normalizeLimit<rule>> : kind extends "before" ? schema extends {
|
|
139
|
-
exclusive: true;
|
|
140
|
-
} ? Before<normalizeLimit<rule>> : AtOrBefore<normalizeLimit<rule>> : Narrowed : never;
|
|
141
|
-
export type distillIn<t> = finalizeDistillation<t, _distill<t, "in", "base">>;
|
|
142
|
-
export type distillOut<t> = finalizeDistillation<t, _distill<t, "out", "base">>;
|
|
143
|
-
export type distillConstrainableIn<t> = finalizeDistillation<t, _distill<t, "in", "constrainable">>;
|
|
144
|
-
export type distillConstrainableOut<t> = finalizeDistillation<t, _distill<t, "out", "constrainable">>;
|
|
145
|
-
export type distillValidatedOut<t> = finalizeDistillation<t, _distill<t, "validatedOut", "constrainable">>;
|
|
146
|
-
type finalizeDistillation<t, distilled> = equals<t, distilled> extends true ? t : distilled;
|
|
147
|
-
export type includesMorphs<t> = [
|
|
148
|
-
_distill<t, "in", "constrainable">,
|
|
149
|
-
_distill<t, "out", "constrainable">
|
|
150
|
-
] extends ([
|
|
151
|
-
_distill<t, "out", "constrainable">,
|
|
152
|
-
_distill<t, "in", "constrainable">
|
|
153
|
-
]) ? false : true;
|
|
154
|
-
type IoKind = "in" | "out" | "validatedOut";
|
|
155
|
-
type DistilledKind = "base" | "constrainable";
|
|
156
|
-
type _distill<t, io extends IoKind, distilledKind extends DistilledKind> = t extends undefined ? t : [t] extends [anyOrNever] ? t : parseConstraints<t> extends ([
|
|
157
|
-
infer base,
|
|
158
|
-
infer constraints extends Constraints
|
|
159
|
-
]) ? distilledKind extends "base" ? _distill<base, io, distilledKind> : constrain<_distill<base, io, distilledKind>, constraints> : t extends TerminallyInferredObjectKind | Primitive ? t : unknown extends t ? unknown : t extends MorphAst<infer i, infer o> ? io extends "in" ? _distill<i, io, distilledKind> : io extends "validatedOut" ? o extends To<infer validatedOut> ? _distill<validatedOut, io, distilledKind> : unknown : _distill<o[1], io, distilledKind> : t extends DefaultableAst<infer t> ? _distill<t, io, distilledKind> : t extends array ? distillArray<t, io, distilledKind, []> : t extends Function ? t : {
|
|
160
|
-
[k in keyof t]: t[k];
|
|
161
|
-
} extends t ? io extends "in" ? show<{
|
|
162
|
-
[k in keyof t as k extends defaultableKeyOf<t> ? never : k]: _distill<t[k], io, distilledKind>;
|
|
163
|
-
} & {
|
|
164
|
-
[k in defaultableKeyOf<t>]?: _distill<t[k], io, distilledKind>;
|
|
165
|
-
}> : {
|
|
166
|
-
[k in keyof t]: _distill<t[k], io, distilledKind>;
|
|
167
|
-
} : t;
|
|
168
|
-
export type defaultableKeyOf<t> = {
|
|
169
|
-
[k in keyof t]: [t[k]] extends [anyOrNever] ? never : t[k] extends DefaultableAst ? k : never;
|
|
170
|
-
}[keyof t];
|
|
171
|
-
type distillArray<t extends array, io extends IoKind, constraints extends DistilledKind, prefix extends array> = _distillArray<t, io, constraints, prefix> extends infer result ? t extends unknown[] ? result : Readonly<t> : never;
|
|
172
|
-
type _distillArray<t extends array, io extends IoKind, constraints extends DistilledKind, prefix extends array> = t extends readonly [infer head, ...infer tail] ? _distillArray<tail, io, constraints, [
|
|
173
|
-
...prefix,
|
|
174
|
-
_distill<head, io, constraints>
|
|
175
|
-
]> : [...prefix, ...distillPostfix<t, io, constraints>];
|
|
176
|
-
type distillPostfix<t extends array, io extends IoKind, constraints extends DistilledKind, postfix extends array = []> = t extends readonly [...infer init, infer last] ? distillPostfix<init, io, constraints, [
|
|
177
|
-
_distill<last, io, constraints>,
|
|
178
|
-
...postfix
|
|
179
|
-
]> : [...{
|
|
180
|
-
[i in keyof t]: _distill<t[i], io, constraints>;
|
|
181
|
-
}, ...postfix];
|
|
182
|
-
/** Objects we don't want to expand during inference like Date or Promise */
|
|
183
|
-
type TerminallyInferredObjectKind = arkPrototypes.instanceOfExcluding<"Array" | "Function"> | ArkEnv.prototypes;
|
|
184
|
-
export type inferPredicate<t, predicate> = predicate extends (data: any, ...args: any[]) => data is infer narrowed ? t extends constrain<unknown, infer constraints> ? applyConstraint<constrain<narrowed, constraints>, "predicate", any> : applyConstraint<narrowed, "predicate", any> : applyConstraint<t, "predicate", any>;
|
|
185
|
-
export type constrainWithPredicate<t> = t extends constrain<unknown, infer constraints> ? applyConstraint<constrain<t, constraints>, "predicate", any> : applyConstraint<t, "predicate", any>;
|
|
186
|
-
export type inferPipes<t, pipes extends Morph[]> = pipes extends [infer head extends Morph, ...infer tail extends Morph[]] ? inferPipes<pipes[0] extends type.cast<infer tPipe> ? inferPipe<t, tPipe> : inferMorphOut<head> extends infer out ? (In: distillConstrainableIn<t>) => Out<out> : never, tail> : t;
|
|
187
|
-
export type inferMorphOut<morph extends Morph> = Exclude<ReturnType<morph>, ArkError | ArkErrors>;
|
|
188
|
-
export type Out<o = any> = ["=>", o, boolean];
|
|
189
|
-
export type To<o = any> = ["=>", o, true];
|
|
190
|
-
export type MorphAst<i = any, o extends Out = Out> = (In: i) => o;
|
|
191
|
-
export type Default<v = any> = ["=", v];
|
|
192
|
-
export type DefaultableAst<t = any, v = any> = (In?: t) => Default<v>;
|
|
193
|
-
export type termOrType<t> = t | Type<t, any>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ErrorMessage } from "@ark/util";
|
|
2
|
-
import type { UnitLiteral } from "../string/shift/operator/default.ts";
|
|
3
|
-
import type { inferAstOut, inferTerminal } from "./infer.ts";
|
|
4
|
-
import type { astToString } from "./utils.ts";
|
|
5
|
-
import type { validateAst } from "./validate.ts";
|
|
6
|
-
export type validateDefault<baseAst, unitLiteral extends UnitLiteral, $, args> = validateAst<baseAst, $, args> extends infer e extends ErrorMessage ? e : inferTerminal<unitLiteral, $, args> extends inferAstOut<baseAst, $, args> ? undefined : ErrorMessage<writeUnassignableDefaultValueMessage<astToString<baseAst>, unitLiteral>>;
|
|
7
|
-
export declare const writeUnassignableDefaultValueMessage: <key extends string, message extends string>(key: key, message: message) => string;
|
|
8
|
-
export type writeUnassignableDefaultValueMessage<baseDef extends string, defaultValue extends string> = `Default value ${defaultValue} is not assignable to ${baseDef}`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const writeUnassignableDefaultValueMessage = (key, message) => `Default value at ${key} ${message}`;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { GenericAst } from "@ark/schema";
|
|
2
|
-
import type { BigintLiteral, Hkt, array } from "@ark/util";
|
|
3
|
-
import type { ArkAmbient } from "../../config.ts";
|
|
4
|
-
import type { inferIntersection } from "../../intersect.ts";
|
|
5
|
-
import type { Date, DateLiteral, Default, LimitLiteral, RegexLiteral, applyConstraint, distillIn, distillOut, normalizeLimit } from "../../keywords/ast.ts";
|
|
6
|
-
import type { string } from "../../keywords/string/string.ts";
|
|
7
|
-
import type { UnparsedScope, resolve, tryInferSubmoduleReference } from "../../scope.ts";
|
|
8
|
-
import type { inferDefinition } from "../definition.ts";
|
|
9
|
-
import type { Comparator, MinComparator } from "../string/reduce/shared.ts";
|
|
10
|
-
import type { StringLiteral } from "../string/shift/operand/enclosed.ts";
|
|
11
|
-
export type inferAstRoot<ast, $, args> = inferConstrainableAst<ast, $, args>;
|
|
12
|
-
export type inferAstIn<ast, $, args> = distillIn<inferAstRoot<ast, $, args>>;
|
|
13
|
-
export type inferAstOut<ast, $, args> = distillOut<inferAstRoot<ast, $, args>>;
|
|
14
|
-
export type inferConstrainableAst<ast, $, args> = ast extends array ? inferExpression<ast, $, args> : ast extends string ? inferTerminal<ast, $, args> : never;
|
|
15
|
-
export type GenericInstantiationAst<generic extends GenericAst = GenericAst, argAsts extends unknown[] = unknown[]> = [generic, "<>", argAsts];
|
|
16
|
-
type resolveScope<g$, $> = g$ extends UnparsedScope ? $ : g$;
|
|
17
|
-
export type inferExpression<ast extends array, $, args> = ast extends GenericInstantiationAst<infer g, infer argAsts> ? g["bodyDef"] extends Hkt ? Hkt.apply<g["bodyDef"], {
|
|
18
|
-
[i in keyof argAsts]: inferConstrainableAst<argAsts[i], $, args>;
|
|
19
|
-
}> : inferDefinition<g["bodyDef"], resolveScope<g["$"], $>, {
|
|
20
|
-
[i in keyof g["names"] & `${number}` as g["names"][i]]: inferConstrainableAst<argAsts[i & keyof argAsts], resolveScope<g["arg$"], $>, args>;
|
|
21
|
-
}> : ast[1] extends "[]" ? inferConstrainableAst<ast[0], $, args>[] : ast[1] extends "|" ? inferConstrainableAst<ast[0], $, args> | inferConstrainableAst<ast[2], $, args> : ast[1] extends "&" ? inferIntersection<inferConstrainableAst<ast[0], $, args>, inferConstrainableAst<ast[2], $, args>> : ast[1] extends "=" ? inferTerminal<ast[2] & string, $, args> extends infer defaultValue ? (In?: inferConstrainableAst<ast[0], $, args>) => Default<defaultValue> : never : ast[1] extends Comparator ? ast[0] extends LimitLiteral ? constrainBound<inferConstrainableAst<ast[2], $, args>, ast[1], ast[0]> : constrainBound<inferConstrainableAst<ast[0], $, args>, ast[1], ast[2]> : ast[1] extends "%" ? applyConstraint<inferConstrainableAst<ast[0], $, args>, "divisor", ast[2] & number> : ast[0] extends "keyof" ? keyof inferConstrainableAst<ast[1], $, args> : never;
|
|
22
|
-
export type constrainBound<constrainableIn, comparator extends Comparator, limit> = distillIn<constrainableIn> extends infer In ? comparator extends "==" ? In extends number ? limit : In extends Date ? Date.literal<normalizeLimit<limit>> : applyConstraint<constrainableIn, "exactLength", limit & number> : applyConstraint<constrainableIn, In extends number ? comparator extends MinComparator ? "min" : "max" : In extends string | array ? comparator extends MinComparator ? "minLength" : "maxLength" : comparator extends MinComparator ? "after" : "before", {
|
|
23
|
-
rule: normalizeLimit<limit>;
|
|
24
|
-
exclusive: comparator extends ">" | "<" ? true : false;
|
|
25
|
-
}> : never;
|
|
26
|
-
export type PrefixOperator = "keyof" | "instanceof" | "===" | "node";
|
|
27
|
-
export type PrefixExpression<operator extends PrefixOperator = PrefixOperator, operand = unknown> = [operator, operand];
|
|
28
|
-
export type PostfixOperator = "[]";
|
|
29
|
-
export type PostfixExpression<operator extends PostfixOperator = PostfixOperator, operand = unknown> = readonly [operand, operator];
|
|
30
|
-
export type InfixOperator = "|" | "&" | Comparator | "%" | ":" | "=>" | "@";
|
|
31
|
-
export type InfixExpression<operator extends InfixOperator = InfixOperator, l = unknown, r = unknown> = [l, operator, r];
|
|
32
|
-
export type inferTerminal<token extends string, $, args> = token extends keyof args | keyof $ ? resolve<token, $, args> : token extends keyof ArkAmbient.$ ? resolve<token, ArkAmbient.$, args> : `#${token}` extends keyof $ ? resolve<`#${token}`, $, args> : token extends StringLiteral<infer text> ? text : token extends `${infer n extends number}` ? n : token extends BigintLiteral<infer b> ? b : token extends RegexLiteral<infer source> ? string.matching<source> : token extends DateLiteral<infer source> ? Date.literal<source> : tryInferSubmoduleReference<$, token>;
|
|
33
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Stringifiable } from "@ark/util";
|
|
2
|
-
import type { Comparator } from "../string/reduce/shared.ts";
|
|
3
|
-
import type { InfixExpression, PostfixExpression } from "./infer.ts";
|
|
4
|
-
export type astToString<ast> = ast extends PostfixExpression<infer operator, infer operand> ? operator extends "[]" ? `${astToString<operand>}[]` : never : ast extends InfixExpression<infer operator, infer l, infer r> ? operator extends "&" | "|" | "%" | Comparator ? `${astToString<l>} ${operator} ${astToString<r>}` : never : ast extends Stringifiable ? `${ast extends bigint ? `${ast}n` : ast}` : "...";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { arkKind, GenericParamAst, PrivateDeclaration, writeMissingSubmoduleAccessMessage, writeUnsatisfiedParameterConstraintMessage } from "@ark/schema";
|
|
2
|
-
import type { anyOrNever, array, BigintLiteral, charsAfterFirst, Completion, ErrorMessage, typeToString, writeMalformedNumericLiteralMessage } from "@ark/util";
|
|
3
|
-
import type { Generic } from "../../generic.ts";
|
|
4
|
-
import type { Comparator } from "../string/reduce/shared.ts";
|
|
5
|
-
import type { writeInvalidGenericArgCountMessage } from "../string/shift/operand/genericArgs.ts";
|
|
6
|
-
import type { UnitLiteral } from "../string/shift/operator/default.ts";
|
|
7
|
-
import type { parseString } from "../string/string.ts";
|
|
8
|
-
import type { validateRange } from "./bounds.ts";
|
|
9
|
-
import type { validateDefault } from "./default.ts";
|
|
10
|
-
import type { validateDivisor } from "./divisor.ts";
|
|
11
|
-
import type { GenericInstantiationAst, inferAstRoot, InfixExpression, PostfixExpression } from "./infer.ts";
|
|
12
|
-
import type { validateKeyof } from "./keyof.ts";
|
|
13
|
-
import type { astToString } from "./utils.ts";
|
|
14
|
-
export type validateAst<ast, $, args> = ast extends string ? validateStringAst<ast, $> : ast extends PostfixExpression<infer operator, infer operand> ? operator extends "[]" ? validateAst<operand, $, args> : never : ast extends InfixExpression<infer operator, infer l, infer r> ? operator extends "&" | "|" ? validateInfix<ast, $, args> : operator extends Comparator ? validateRange<l, operator, r, $, args> : operator extends "%" ? validateDivisor<l, $, args> : undefined : ast extends [infer baseAst, "=", infer unitLiteral extends UnitLiteral] ? validateDefault<baseAst, unitLiteral, $, args> : ast extends ["keyof", infer operand] ? validateKeyof<operand, $, args> : ast extends GenericInstantiationAst<infer g, infer argAsts> ? validateGenericArgs<g["paramsAst"], argAsts, $, args, []> : ErrorMessage<writeUnexpectedExpressionMessage<astToString<ast>>> & {
|
|
15
|
-
ast: ast;
|
|
16
|
-
};
|
|
17
|
-
type writeUnexpectedExpressionMessage<expression extends string> = `Unexpectedly failed to parse the expression resulting from ${expression}`;
|
|
18
|
-
type validateGenericArgs<params extends array<GenericParamAst>, argAsts extends array, $, args, indices extends 1[]> = argAsts extends readonly [infer arg, ...infer argsTail] ? validateAst<arg, $, args> extends infer e extends ErrorMessage ? e : inferAstRoot<arg, $, args> extends params[indices["length"]][1] ? validateGenericArgs<params, argsTail, $, args, [...indices, 1]> : ErrorMessage<writeUnsatisfiedParameterConstraintMessage<params[indices["length"]][0], typeToString<params[indices["length"]][1]>, astToString<arg>>> : undefined;
|
|
19
|
-
export declare const writePrefixedPrivateReferenceMessage: <def extends PrivateDeclaration>(def: def) => writePrefixedPrivateReferenceMessage<def>;
|
|
20
|
-
export type writePrefixedPrivateReferenceMessage<def extends PrivateDeclaration> = `Private type references should not include '#'. Use '${charsAfterFirst<def>}' instead.`;
|
|
21
|
-
type validateStringAst<def extends string, $> = def extends `${infer n extends number}` ? number extends n ? ErrorMessage<writeMalformedNumericLiteralMessage<def, "number">> : undefined : def extends BigintLiteral<infer b> ? bigint extends b ? ErrorMessage<writeMalformedNumericLiteralMessage<def, "bigint">> : undefined : maybeExtractAlias<def, $> extends infer alias extends keyof $ ? [
|
|
22
|
-
$[alias]
|
|
23
|
-
] extends [anyOrNever] ? def : def extends PrivateDeclaration ? ErrorMessage<writePrefixedPrivateReferenceMessage<def>> : $[alias] extends Generic ? ErrorMessage<writeInvalidGenericArgCountMessage<def, $[alias]["names"], []>> : $[alias] extends {
|
|
24
|
-
[arkKind]: "module";
|
|
25
|
-
} ? "$root" extends keyof $[alias] ? undefined : ErrorMessage<writeMissingSubmoduleAccessMessage<def>> : undefined : def extends ErrorMessage ? def : undefined;
|
|
26
|
-
export type maybeExtractAlias<def extends string, $> = def extends keyof $ ? def : `#${def}` extends keyof $ ? `#${def}` : null;
|
|
27
|
-
export type validateString<def extends string, $, args> = validateAst<parseString<def, $, args>, $, args> extends (infer result extends ErrorMessage) ? result extends Completion<infer text> ? text : result : def;
|
|
28
|
-
type validateInfix<ast extends InfixExpression, $, args> = validateAst<ast[0], $, args> extends infer e extends ErrorMessage ? e : validateAst<ast[2], $, args> extends infer e extends ErrorMessage ? e : undefined;
|
|
29
|
-
export {};
|
package/out/subtypes/base.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { ArkErrors, BaseRoot, Disjoint, JsonSchema, MetaSchema, Morph, UndeclaredKeyBehavior } from "@ark/schema";
|
|
2
|
-
import type { anyOrNever, Callable, ErrorMessage, inferred, Json, unset } from "@ark/util";
|
|
3
|
-
import type { inferIntersection } from "../intersect.ts";
|
|
4
|
-
import type { distillConstrainableIn, distillConstrainableOut, distillIn, distillOut, distillValidatedOut, inferMorphOut, inferPipes } from "../keywords/ast.ts";
|
|
5
|
-
import type { Scope } from "../scope.ts";
|
|
6
|
-
import type { inferTypeRoot, validateTypeRoot } from "../type.ts";
|
|
7
|
-
import type { ArrayType } from "./array.ts";
|
|
8
|
-
import type { instantiateType } from "./instantiate.ts";
|
|
9
|
-
/** @ts-ignore cast variance */
|
|
10
|
-
interface Type<out t = unknown, $ = {}> extends Callable<(data: unknown) => distillOut<t> | ArkErrors> {
|
|
11
|
-
t: t;
|
|
12
|
-
tIn: distillConstrainableIn<t>;
|
|
13
|
-
tOut: distillConstrainableOut<t>;
|
|
14
|
-
tValidatedOut: distillValidatedOut<t>;
|
|
15
|
-
infer: distillOut<t>;
|
|
16
|
-
inferIn: distillIn<t>;
|
|
17
|
-
[inferred]: t;
|
|
18
|
-
json: Json;
|
|
19
|
-
toJsonSchema(): JsonSchema;
|
|
20
|
-
description: string;
|
|
21
|
-
expression: string;
|
|
22
|
-
internal: BaseRoot;
|
|
23
|
-
$: Scope<$>;
|
|
24
|
-
assert(data: unknown): this["infer"];
|
|
25
|
-
allows(data: unknown): data is this["inferIn"];
|
|
26
|
-
traverse(data: unknown): distillOut<t> | ArkErrors;
|
|
27
|
-
configure(meta: MetaSchema): this;
|
|
28
|
-
describe(description: string): this;
|
|
29
|
-
onUndeclaredKey(behavior: UndeclaredKeyBehavior): this;
|
|
30
|
-
onDeepUndeclaredKey(behavior: UndeclaredKeyBehavior): this;
|
|
31
|
-
from(literal: this["inferIn"]): this["infer"];
|
|
32
|
-
as<t = unset>(...args: validateChainedAsArgs<t>): instantiateType<t, $>;
|
|
33
|
-
get in(): instantiateType<this["tIn"], $>;
|
|
34
|
-
get out(): instantiateType<this["tValidatedOut"], $>;
|
|
35
|
-
intersect<const def, r = inferTypeRoot<def, $>>(def: validateTypeRoot<def, $>): instantiateType<inferIntersection<t, r>, $> | Disjoint;
|
|
36
|
-
and<const def, r = inferTypeRoot<def, $>>(def: validateTypeRoot<def, $>): instantiateType<inferIntersection<t, r>, $>;
|
|
37
|
-
or<const def, r = inferTypeRoot<def, $>>(def: validateTypeRoot<def, $>): instantiateType<t | r, $>;
|
|
38
|
-
array(): ArrayType<t[], $>;
|
|
39
|
-
pipe: ChainedPipes<t, $>;
|
|
40
|
-
equals<def>(def: validateTypeRoot<def, $>): this is instantiateType<inferTypeRoot<def, $>, $>;
|
|
41
|
-
extract<def>(r: validateTypeRoot<def, $>): instantiateType<Extract<t, inferTypeRoot<def, $>>, $>;
|
|
42
|
-
exclude<def>(r: validateTypeRoot<def, $>): instantiateType<Exclude<t, inferTypeRoot<def, $>>, $>;
|
|
43
|
-
extends<def>(other: validateTypeRoot<def, $>): this is instantiateType<inferTypeRoot<def, $>, $>;
|
|
44
|
-
overlaps<def>(r: validateTypeRoot<def, $>): boolean;
|
|
45
|
-
/** @deprecated */
|
|
46
|
-
apply: Function["apply"];
|
|
47
|
-
/** @deprecated */
|
|
48
|
-
bind: Function["bind"];
|
|
49
|
-
/** @deprecated */
|
|
50
|
-
call: Function["call"];
|
|
51
|
-
/** @deprecated */
|
|
52
|
-
caller: Function;
|
|
53
|
-
/** @deprecated */
|
|
54
|
-
length: number;
|
|
55
|
-
/** @deprecated */
|
|
56
|
-
name: string;
|
|
57
|
-
/** @deprecated */
|
|
58
|
-
prototype: Function["prototype"];
|
|
59
|
-
/** @deprecated */
|
|
60
|
-
arguments: Function["arguments"];
|
|
61
|
-
/** @deprecated */
|
|
62
|
-
Symbol: never;
|
|
63
|
-
}
|
|
64
|
-
interface ChainedPipeSignature<t, $> {
|
|
65
|
-
<a extends Morph<distillOut<t>>, r = instantiateType<inferPipes<t, [a]>, $>>(a: a): r;
|
|
66
|
-
<a extends Morph<distillOut<t>>, b extends Morph<inferMorphOut<a>>, r = instantiateType<inferPipes<t, [a, b]>, $>>(a: a, b: b): r;
|
|
67
|
-
<a extends Morph<distillOut<t>>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, r = instantiateType<inferPipes<t, [a, b, c]>, $>>(a: a, b: b, c: c): r;
|
|
68
|
-
<a extends Morph<distillOut<t>>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, r = instantiateType<inferPipes<t, [a, b, c, d]>, $>>(a: a, b: b, c: c, d: d): r;
|
|
69
|
-
<a extends Morph<distillOut<t>>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>, r = instantiateType<inferPipes<t, [a, b, c, d, e]>, $>>(a: a, b: b, c: c, d: d, e: e): r;
|
|
70
|
-
<a extends Morph<distillOut<t>>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>, f extends Morph<inferMorphOut<e>>, r = instantiateType<inferPipes<t, [a, b, c, d, e, f]>, $>>(a: a, b: b, c: c, d: d, e: e, f: f): r;
|
|
71
|
-
<a extends Morph<distillOut<t>>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>, f extends Morph<inferMorphOut<e>>, g extends Morph<inferMorphOut<f>>, r = instantiateType<inferPipes<t, [a, b, c, d, e, f, g]>, $>>(a: a, b: b, c: c, d: d, e: e, f: f, g: g): r;
|
|
72
|
-
}
|
|
73
|
-
export interface ChainedPipes<t, $> extends ChainedPipeSignature<t, $> {
|
|
74
|
-
try: ChainedPipeSignature<t, $>;
|
|
75
|
-
}
|
|
76
|
-
type validateChainedAsArgs<t> = [
|
|
77
|
-
t
|
|
78
|
-
] extends [unset] ? [
|
|
79
|
-
t
|
|
80
|
-
] extends [anyOrNever] ? [
|
|
81
|
-
] : [
|
|
82
|
-
ErrorMessage<"as requires an explicit type parameter like myType.as<t>()">
|
|
83
|
-
] : [];
|
|
84
|
-
export type { Type as BaseType };
|
package/out/subtypes/morph.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Predicate, PredicateCast } from "@ark/schema";
|
|
2
|
-
import type { inferPipe } from "../intersect.ts";
|
|
3
|
-
import type { applyConstraint, Out, To } from "../keywords/ast.ts";
|
|
4
|
-
import type { inferTypeRoot, validateTypeRoot } from "../type.ts";
|
|
5
|
-
import type { BaseType } from "./base.ts";
|
|
6
|
-
/** @ts-ignore cast variance */
|
|
7
|
-
interface Type<out t = unknown, $ = {}> extends BaseType<t, $> {
|
|
8
|
-
to<const def, r = inferTypeRoot<def, $>>(def: validateTypeRoot<def, $>): Type<inferPipe<t, r>, $>;
|
|
9
|
-
narrow<narrowed extends this["infer"] = never>(predicate: Predicate<this["infer"]> | PredicateCast<this["infer"], narrowed>): Type<([
|
|
10
|
-
narrowed
|
|
11
|
-
] extends [never] ? applyConstraint<this["tOut"], "predicate", Predicate> : narrowed) extends infer o ? this["tValidatedOut"] extends this["tOut"] ? (In: this["tIn"]) => To<o> : (In: this["tIn"]) => Out<o> : never, $>;
|
|
12
|
-
}
|
|
13
|
-
export type { Type as MorphType };
|
package/out/subtypes/object.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { array, ErrorType, merge } from "@ark/util";
|
|
2
|
-
import type { arkKeyOf, getArkKey, toArkKey } from "../keys.ts";
|
|
3
|
-
import type { type } from "../keywords/ark.ts";
|
|
4
|
-
import type { inferTypeRoot, validateTypeRoot } from "../type.ts";
|
|
5
|
-
import type { ArrayType } from "./array.ts";
|
|
6
|
-
import type { instantiateType } from "./instantiate.ts";
|
|
7
|
-
import type { ValidatorType } from "./validator.ts";
|
|
8
|
-
/** @ts-ignore cast variance */
|
|
9
|
-
interface Type<out t extends object = object, $ = {}> extends ValidatorType<t, $> {
|
|
10
|
-
readonly(): t extends array ? ArrayType<{
|
|
11
|
-
readonly [i in keyof t]: t[i];
|
|
12
|
-
}, $> : Type<{
|
|
13
|
-
readonly [k in keyof t]: t[k];
|
|
14
|
-
}, $>;
|
|
15
|
-
keyof(): instantiateType<keyof t, $>;
|
|
16
|
-
get<k1 extends arkKeyOf<t>, r = instantiateType<getArkKey<t, k1>, $>>(k1: k1 | type.cast<k1>): r;
|
|
17
|
-
get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>, r = instantiateType<getArkKey<getArkKey<t, k1>, k2>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>): r;
|
|
18
|
-
get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>, k3 extends arkKeyOf<getArkKey<getArkKey<t, k1>, k2>>, r = instantiateType<getArkKey<getArkKey<getArkKey<t, k1>, k2>, k3>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>, k3: k3 | type.cast<k3>): r;
|
|
19
|
-
pick<const key extends arkKeyOf<t> = never>(...keys: (key | type.cast<key>)[]): Type<{
|
|
20
|
-
[k in keyof t as Extract<toArkKey<t, k>, key>]: t[k];
|
|
21
|
-
}, $>;
|
|
22
|
-
omit<const key extends arkKeyOf<t> = never>(...keys: (key | type.cast<key>)[]): Type<{
|
|
23
|
-
[k in keyof t as Exclude<toArkKey<t, k>, key>]: t[k];
|
|
24
|
-
}, $>;
|
|
25
|
-
merge<const def, r = inferTypeRoot<def, $>>(def: validateTypeRoot<def, $> & (r extends object ? unknown : ErrorType<"Merged type must be an object", [actual: r]>)): Type<merge<t, r & object>, $>;
|
|
26
|
-
required(): Type<{
|
|
27
|
-
[k in keyof t]-?: t[k];
|
|
28
|
-
}, $>;
|
|
29
|
-
partial(): Type<{
|
|
30
|
-
[k in keyof t]?: t[k];
|
|
31
|
-
}, $>;
|
|
32
|
-
}
|
|
33
|
-
export type { Type as ObjectType };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|