@strictly/define 0.0.6 → 0.0.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.
- package/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/types/builders.d.ts +2 -1
- package/.out/types/builders.js +3 -1
- package/.out/types/specs/flattened_accessors_of_type.tests.js +1 -2
- package/.out/types/specs/flattened_types_of_type.tests.js +8 -16
- package/.out/types/specs/flattened_validators_of_validating_type.tests.js +2 -4
- package/.out/types/specs/flattened_values_of_type.tests.js +2 -4
- package/.out/types/specs/partial_type_of_type.tests.js +6 -12
- package/.out/types/specs/paths_of_type.tests.js +23 -39
- package/.out/types/specs/readonly_type_of_type.tests.js +7 -14
- package/.out/types/specs/strict_definitions.tests.js +2 -4
- package/.out/types/specs/type_of_type.tests.js +3 -6
- package/.out/types/specs/value_of_type.tests.js +13 -26
- package/.out/types/specs/value_to_type_paths_of_type.tests.js +8 -16
- package/.out/validation/specs/errors_of_validators.tests.js +1 -2
- package/.out/validation/specs/validators_of_values.tests.js +3 -6
- package/.out/validation/validator.d.ts +2 -2
- package/.out/validation/validator.js +0 -1
- package/.out/validation/validators/defined_validator.d.ts +1 -1
- package/.out/validation/validators/minimum_string_length_validator.d.ts +1 -1
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/dist/index.cjs +27 -26
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +27 -26
- package/package.json +1 -1
- package/types/builders.ts +8 -2
- package/types/specs/flattened_accessors_of_type.tests.ts +2 -2
- package/types/specs/flattened_types_of_type.tests.ts +16 -16
- package/types/specs/flattened_validators_of_validating_type.tests.ts +4 -4
- package/types/specs/flattened_values_of_type.tests.ts +4 -4
- package/types/specs/partial_type_of_type.tests.ts +12 -12
- package/types/specs/paths_of_type.tests.ts +39 -39
- package/types/specs/readonly_type_of_type.tests.ts +14 -14
- package/types/specs/strict_definitions.tests.ts +6 -6
- package/types/specs/type_of_type.tests.ts +6 -6
- package/types/specs/value_of_type.tests.ts +26 -26
- package/types/specs/value_to_type_paths_of_type.tests.ts +16 -16
- package/validation/specs/errors_of_validators.tests.ts +2 -2
- package/validation/specs/validators_of_values.tests.ts +6 -6
- package/validation/validator.ts +13 -4
- package/validation/validators/defined_validator.ts +1 -3
- package/validation/validators/minimum_string_length_validator.ts +2 -2
|
@@ -12,12 +12,12 @@ describe('FlattenedValuesOfType', function () {
|
|
|
12
12
|
const builder = record<typeof numberType, string>(numberType)
|
|
13
13
|
type V = FlattenedValuesOfType<typeof builder.narrow>
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
type C = {
|
|
16
16
|
readonly $: Record<string, number>,
|
|
17
17
|
readonly [_: `$.${string}`]: number,
|
|
18
18
|
}
|
|
19
19
|
it('equals expected type', function () {
|
|
20
|
-
expectTypeOf(
|
|
20
|
+
expectTypeOf<C>().toEqualTypeOf<V>()
|
|
21
21
|
})
|
|
22
22
|
})
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ describe('FlattenedValuesOfType', function () {
|
|
|
25
25
|
const builder = object().optionalField('a', stringType)
|
|
26
26
|
type V = FlattenedValuesOfType<typeof builder>
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
type C = {
|
|
29
29
|
readonly $: {
|
|
30
30
|
a?: string | undefined,
|
|
31
31
|
},
|
|
@@ -33,7 +33,7 @@ describe('FlattenedValuesOfType', function () {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
it('equals expected type', function () {
|
|
36
|
-
expectTypeOf(
|
|
36
|
+
expectTypeOf<C>().toEqualTypeOf<V>()
|
|
37
37
|
})
|
|
38
38
|
})
|
|
39
39
|
})
|
|
@@ -14,7 +14,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
14
14
|
describe('literal', function () {
|
|
15
15
|
type T = PartialTypeOfType<typeof numberType._type>
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
type C = {
|
|
18
18
|
readonly typeDef: {
|
|
19
19
|
readonly type: TypeDefType.Union,
|
|
20
20
|
readonly discriminator: null,
|
|
@@ -32,7 +32,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
it('equals expected type', function () {
|
|
35
|
-
expectTypeOf(
|
|
35
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
40
40
|
const builder = list(numberType)
|
|
41
41
|
type T = PartialTypeOfType<typeof builder._type>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
type C = {
|
|
44
44
|
readonly typeDef: {
|
|
45
45
|
readonly type: TypeDefType.Union,
|
|
46
46
|
readonly discriminator: null,
|
|
@@ -70,7 +70,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
70
70
|
},
|
|
71
71
|
}
|
|
72
72
|
it('equals expected type', function () {
|
|
73
|
-
expectTypeOf(
|
|
73
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
78
78
|
const builder = record<typeof numberType, 'a' | 'b'>(numberType)
|
|
79
79
|
type T = SimplifyDeep<PartialTypeOfType<typeof builder._type>>
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
type C = {
|
|
82
82
|
readonly typeDef: {
|
|
83
83
|
readonly type: TypeDefType.Union,
|
|
84
84
|
readonly discriminator: null,
|
|
@@ -110,7 +110,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
it('equals expected type', function () {
|
|
113
|
-
expectTypeOf(
|
|
113
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
114
114
|
})
|
|
115
115
|
})
|
|
116
116
|
|
|
@@ -120,7 +120,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
120
120
|
.readonlyField('b', stringType)
|
|
121
121
|
type T = PartialTypeOfType<typeof builder._type>
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
type C = {
|
|
124
124
|
readonly typeDef: {
|
|
125
125
|
readonly type: TypeDefType.Union,
|
|
126
126
|
readonly discriminator: null,
|
|
@@ -167,7 +167,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
it('equals expected type', function () {
|
|
170
|
-
expectTypeOf(
|
|
170
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
171
171
|
})
|
|
172
172
|
})
|
|
173
173
|
|
|
@@ -178,7 +178,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
178
178
|
.or('2', stringType)
|
|
179
179
|
type T = PartialTypeOfType<typeof builder._type>
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
type C = {
|
|
182
182
|
readonly typeDef: {
|
|
183
183
|
readonly type: TypeDefType.Union,
|
|
184
184
|
readonly discriminator: null,
|
|
@@ -206,7 +206,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
it('equals expected type', function () {
|
|
209
|
-
expectTypeOf(
|
|
209
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
210
210
|
})
|
|
211
211
|
})
|
|
212
212
|
})
|
|
@@ -215,7 +215,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
215
215
|
const builder = list(numberType).readonly()
|
|
216
216
|
type T = PartialTypeOfType<typeof builder._type>
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
type C = {
|
|
219
219
|
readonly typeDef: {
|
|
220
220
|
readonly type: TypeDefType.Union,
|
|
221
221
|
readonly discriminator: null,
|
|
@@ -245,7 +245,7 @@ describe('PartialTypeDefOf', function () {
|
|
|
245
245
|
},
|
|
246
246
|
}
|
|
247
247
|
it('equals expected type', function () {
|
|
248
|
-
expectTypeOf(
|
|
248
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
249
249
|
})
|
|
250
250
|
})
|
|
251
251
|
})
|
|
@@ -12,13 +12,13 @@ import { type PathsOfType } from 'types/paths_of_type'
|
|
|
12
12
|
|
|
13
13
|
describe('PathsOfType', function () {
|
|
14
14
|
describe('literal', function () {
|
|
15
|
-
|
|
15
|
+
type P = '$'
|
|
16
16
|
|
|
17
17
|
describe('regular', function () {
|
|
18
18
|
type T = PathsOfType<typeof stringType>
|
|
19
19
|
|
|
20
20
|
it('equals expected type', function () {
|
|
21
|
-
expectTypeOf(
|
|
21
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
22
22
|
})
|
|
23
23
|
})
|
|
24
24
|
|
|
@@ -27,20 +27,20 @@ describe('PathsOfType', function () {
|
|
|
27
27
|
type T = PathsOfType<typeof builder>
|
|
28
28
|
|
|
29
29
|
it('equals expected type', function () {
|
|
30
|
-
expectTypeOf(
|
|
30
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
31
31
|
})
|
|
32
32
|
})
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
describe('list', function () {
|
|
36
|
-
|
|
36
|
+
type P = '$' | `$.${number}`
|
|
37
37
|
|
|
38
38
|
describe('mutable', function () {
|
|
39
39
|
const builder = list(stringType)
|
|
40
40
|
type T = PathsOfType<typeof builder>
|
|
41
41
|
|
|
42
42
|
it('equals expected type', function () {
|
|
43
|
-
expectTypeOf(
|
|
43
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
44
44
|
})
|
|
45
45
|
})
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ describe('PathsOfType', function () {
|
|
|
49
49
|
type T = PathsOfType<typeof builder>
|
|
50
50
|
|
|
51
51
|
it('equals expected type', function () {
|
|
52
|
-
expectTypeOf(
|
|
52
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ describe('PathsOfType', function () {
|
|
|
58
58
|
type T = PathsOfType<typeof builder>
|
|
59
59
|
|
|
60
60
|
it('equals expected type', function () {
|
|
61
|
-
expectTypeOf(
|
|
61
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
62
62
|
})
|
|
63
63
|
})
|
|
64
64
|
|
|
@@ -66,22 +66,22 @@ describe('PathsOfType', function () {
|
|
|
66
66
|
const builder = list(stringType)
|
|
67
67
|
type T = PathsOfType<typeof builder, 'o'>
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
type P = '$' | `$.o`
|
|
70
70
|
it('equals expected type', function () {
|
|
71
|
-
expectTypeOf(
|
|
71
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
72
72
|
})
|
|
73
73
|
})
|
|
74
74
|
})
|
|
75
75
|
|
|
76
76
|
describe('record', function () {
|
|
77
|
-
|
|
77
|
+
type P = '$' | `$.${string}` | `$.${number}`
|
|
78
78
|
|
|
79
79
|
describe('mutable', function () {
|
|
80
80
|
const builder = record(stringType)
|
|
81
81
|
type T = PathsOfType<typeof builder>
|
|
82
82
|
|
|
83
83
|
it('equals expected type', function () {
|
|
84
|
-
expectTypeOf(
|
|
84
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
85
85
|
})
|
|
86
86
|
})
|
|
87
87
|
|
|
@@ -89,9 +89,9 @@ describe('PathsOfType', function () {
|
|
|
89
89
|
const builder = record<typeof stringType, 'a' | 'b'>(stringType)
|
|
90
90
|
type T = PathsOfType<typeof builder>
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
type P = '$' | '$.a' | '$.b'
|
|
93
93
|
it('equals expected type', function () {
|
|
94
|
-
expectTypeOf(
|
|
94
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
95
95
|
})
|
|
96
96
|
})
|
|
97
97
|
|
|
@@ -99,9 +99,9 @@ describe('PathsOfType', function () {
|
|
|
99
99
|
const builder = record<typeof stringType, 1 | 2 | 3>(stringType)
|
|
100
100
|
type T = PathsOfType<typeof builder>
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
type P = '$' | '$.1' | '$.2' | '$.3'
|
|
103
103
|
it('equals expected type', function () {
|
|
104
|
-
expectTypeOf(
|
|
104
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
105
105
|
})
|
|
106
106
|
})
|
|
107
107
|
|
|
@@ -110,7 +110,7 @@ describe('PathsOfType', function () {
|
|
|
110
110
|
type T = PathsOfType<typeof builder>
|
|
111
111
|
|
|
112
112
|
it('equals expected type', function () {
|
|
113
|
-
expectTypeOf(
|
|
113
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
114
114
|
})
|
|
115
115
|
})
|
|
116
116
|
|
|
@@ -119,7 +119,7 @@ describe('PathsOfType', function () {
|
|
|
119
119
|
type T = PathsOfType<typeof builder>
|
|
120
120
|
|
|
121
121
|
it('equals expected type', function () {
|
|
122
|
-
expectTypeOf(
|
|
122
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
123
123
|
})
|
|
124
124
|
})
|
|
125
125
|
|
|
@@ -128,7 +128,7 @@ describe('PathsOfType', function () {
|
|
|
128
128
|
type T = PathsOfType<typeof builder>
|
|
129
129
|
|
|
130
130
|
it('equals expected type', function () {
|
|
131
|
-
expectTypeOf(
|
|
131
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
132
132
|
})
|
|
133
133
|
})
|
|
134
134
|
|
|
@@ -136,9 +136,9 @@ describe('PathsOfType', function () {
|
|
|
136
136
|
const builder = record(stringType)
|
|
137
137
|
type T = PathsOfType<typeof builder, 'x'>
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
type P = '$' | '$.x'
|
|
140
140
|
it('equals expected type', function () {
|
|
141
|
-
expectTypeOf(
|
|
141
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
142
142
|
})
|
|
143
143
|
})
|
|
144
144
|
})
|
|
@@ -151,9 +151,9 @@ describe('PathsOfType', function () {
|
|
|
151
151
|
.field('s', stringType)
|
|
152
152
|
type T = PathsOfType<typeof builder>
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
type P = '$' | '$.n' | '$.b' | '$.s'
|
|
155
155
|
it('equals expected type', function () {
|
|
156
|
-
expectTypeOf(
|
|
156
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
157
157
|
})
|
|
158
158
|
|
|
159
159
|
it('can be used in a record', function () {
|
|
@@ -171,7 +171,7 @@ describe('PathsOfType', function () {
|
|
|
171
171
|
|
|
172
172
|
it('ignores override', function () {
|
|
173
173
|
type T = PathsOfType<typeof builder, 'y'>
|
|
174
|
-
expectTypeOf(
|
|
174
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
175
175
|
})
|
|
176
176
|
})
|
|
177
177
|
|
|
@@ -181,9 +181,9 @@ describe('PathsOfType', function () {
|
|
|
181
181
|
.field('s2', object().field('a2', stringType))
|
|
182
182
|
type T = PathsOfType<typeof builder>
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
type P = '$' | '$.s1' | '$.s1.a1' | '$.s2' | '$.s2.a2'
|
|
185
185
|
it('equals expected type', function () {
|
|
186
|
-
expectTypeOf(
|
|
186
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
187
187
|
})
|
|
188
188
|
})
|
|
189
189
|
|
|
@@ -194,18 +194,18 @@ describe('PathsOfType', function () {
|
|
|
194
194
|
describe('no override', function () {
|
|
195
195
|
type T = PathsOfType<typeof builder>
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
type P = '$' | '$.l' | `$.l.${number}`
|
|
198
198
|
it('equals expected type', function () {
|
|
199
|
-
expectTypeOf(
|
|
199
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
200
200
|
})
|
|
201
201
|
})
|
|
202
202
|
|
|
203
203
|
describe('passes override', function () {
|
|
204
204
|
type T = PathsOfType<typeof builder, 'o'>
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
type P = '$' | '$.l' | '$.l.o'
|
|
207
207
|
it('equals expected type', function () {
|
|
208
|
-
expectTypeOf(
|
|
208
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
209
209
|
})
|
|
210
210
|
})
|
|
211
211
|
})
|
|
@@ -218,9 +218,9 @@ describe('PathsOfType', function () {
|
|
|
218
218
|
.or('2', stringType)
|
|
219
219
|
type T = PathsOfType<typeof builder>
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
type P = '$'
|
|
222
222
|
it('equals expected type', function () {
|
|
223
|
-
expectTypeOf(
|
|
223
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
224
224
|
})
|
|
225
225
|
})
|
|
226
226
|
|
|
@@ -231,9 +231,9 @@ describe('PathsOfType', function () {
|
|
|
231
231
|
.or('3', object().field('c', stringType).field('a', stringType))
|
|
232
232
|
type T = PathsOfType<typeof builder>
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
type P = '$' | '$.a' | '$.b' | '$.c'
|
|
235
235
|
it('equals expected type', function () {
|
|
236
|
-
expectTypeOf(
|
|
236
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
237
237
|
})
|
|
238
238
|
})
|
|
239
239
|
|
|
@@ -249,9 +249,9 @@ describe('PathsOfType', function () {
|
|
|
249
249
|
))
|
|
250
250
|
type T = PathsOfType<typeof builder>
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
type P = '$' | '$.a' | '$.a.aa' | '$.b' | '$.b.bb'
|
|
253
253
|
it('equals expected type', function () {
|
|
254
|
-
expectTypeOf(
|
|
254
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
255
255
|
})
|
|
256
256
|
})
|
|
257
257
|
})
|
|
@@ -263,10 +263,10 @@ describe('PathsOfType', function () {
|
|
|
263
263
|
|
|
264
264
|
type T = PathsOfType<typeof builder>
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
type P = '$' | '$.1:a' | '$.2:b'
|
|
267
267
|
|
|
268
268
|
it('equals expected type', function () {
|
|
269
|
-
expectTypeOf(
|
|
269
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
270
270
|
})
|
|
271
271
|
})
|
|
272
272
|
|
|
@@ -283,10 +283,10 @@ describe('PathsOfType', function () {
|
|
|
283
283
|
|
|
284
284
|
type T = PathsOfType<typeof builder>
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
type P = '$' | '$.1:p:a' | '$.2:q:b'
|
|
287
287
|
|
|
288
288
|
it('equals expected type', function () {
|
|
289
|
-
expectTypeOf(
|
|
289
|
+
expectTypeOf<P>().toEqualTypeOf<T>()
|
|
290
290
|
})
|
|
291
291
|
})
|
|
292
292
|
|
|
@@ -13,14 +13,14 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
13
13
|
describe('literal', function () {
|
|
14
14
|
type T = ReadonlyTypeOfType<typeof numberType._type>
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type C = {
|
|
17
17
|
readonly definition: {
|
|
18
18
|
readonly type: TypeDefType.Literal,
|
|
19
19
|
readonly valuePrototype: [number],
|
|
20
20
|
},
|
|
21
21
|
}
|
|
22
22
|
it('equals expected type', function () {
|
|
23
|
-
expectTypeOf(
|
|
23
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
24
24
|
})
|
|
25
25
|
})
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
28
28
|
const builder = list(numberType)
|
|
29
29
|
type T = ReadonlyTypeOfType<typeof builder._type>
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
type C = {
|
|
32
32
|
readonly definition: {
|
|
33
33
|
readonly type: TypeDefType.List,
|
|
34
34
|
readonly elements: {
|
|
@@ -38,7 +38,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
38
38
|
},
|
|
39
39
|
}
|
|
40
40
|
it('equals expected type', function () {
|
|
41
|
-
expectTypeOf(
|
|
41
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
42
42
|
})
|
|
43
43
|
})
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
46
46
|
const builder = record<typeof numberType, 'a' | 'b'>(numberType)
|
|
47
47
|
type T = ReadonlyTypeOfType<typeof builder._type>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
type C = {
|
|
50
50
|
readonly definition: {
|
|
51
51
|
readonly type: TypeDefType.Record,
|
|
52
52
|
readonly keyPrototype: 'a' | 'b',
|
|
@@ -57,7 +57,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
57
57
|
},
|
|
58
58
|
}
|
|
59
59
|
it('equals expected type', function () {
|
|
60
|
-
expectTypeOf(
|
|
60
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
61
61
|
})
|
|
62
62
|
})
|
|
63
63
|
|
|
@@ -67,7 +67,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
67
67
|
.optionalField('b', stringType)
|
|
68
68
|
type T = ReadonlyTypeOfType<typeof builder._type>
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
type C = {
|
|
71
71
|
readonly definition: {
|
|
72
72
|
readonly type: TypeDefType.Object,
|
|
73
73
|
readonly fields: {
|
|
@@ -83,7 +83,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
83
83
|
},
|
|
84
84
|
}
|
|
85
85
|
it('equals expected type', function () {
|
|
86
|
-
expectTypeOf(
|
|
86
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
87
87
|
})
|
|
88
88
|
})
|
|
89
89
|
|
|
@@ -93,7 +93,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
93
93
|
.or('2', stringType)
|
|
94
94
|
type T = ReadonlyTypeOfType<typeof builder._type>
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
type C = {
|
|
97
97
|
readonly definition: {
|
|
98
98
|
readonly type: TypeDefType.Union,
|
|
99
99
|
readonly discriminator: null,
|
|
@@ -114,7 +114,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
114
114
|
},
|
|
115
115
|
}
|
|
116
116
|
it('equals expected type', function () {
|
|
117
|
-
expectTypeOf(
|
|
117
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
118
118
|
})
|
|
119
119
|
})
|
|
120
120
|
|
|
@@ -122,7 +122,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
122
122
|
const builder = record<typeof numberType, 'a'>(numberType).partialKeys()
|
|
123
123
|
type T = ReadonlyTypeOfType<typeof builder._type>
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
type C = {
|
|
126
126
|
readonly definition: {
|
|
127
127
|
readonly type: TypeDefType.Record,
|
|
128
128
|
readonly keyPrototype: 'a',
|
|
@@ -133,7 +133,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
133
133
|
},
|
|
134
134
|
}
|
|
135
135
|
it('equals expected type', function () {
|
|
136
|
-
expectTypeOf(
|
|
136
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
137
137
|
})
|
|
138
138
|
})
|
|
139
139
|
|
|
@@ -141,7 +141,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
141
141
|
const builder = record<typeof numberType, 'a'>(numberType).readonlyKeys()
|
|
142
142
|
type T = ReadonlyTypeOfType<typeof builder._type>
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
type C = {
|
|
145
145
|
readonly definition: {
|
|
146
146
|
readonly type: TypeDefType.Record,
|
|
147
147
|
readonly keyPrototype: 'a',
|
|
@@ -152,7 +152,7 @@ describe('ReadonlyTypeDefOf', function () {
|
|
|
152
152
|
},
|
|
153
153
|
}
|
|
154
154
|
it('equals expected type', function () {
|
|
155
|
-
expectTypeOf(
|
|
155
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
156
156
|
})
|
|
157
157
|
})
|
|
158
158
|
})
|
|
@@ -151,11 +151,11 @@ describe('Strict Definitions', function () {
|
|
|
151
151
|
},
|
|
152
152
|
},
|
|
153
153
|
}
|
|
154
|
-
type
|
|
154
|
+
type S = StrictUnionTypeDef<null, U>
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
type C = UnionTypeDef<null, U>
|
|
157
157
|
it('equals type', function () {
|
|
158
|
-
expectTypeOf(
|
|
158
|
+
expectTypeOf<S>().toEqualTypeOf<C>()
|
|
159
159
|
})
|
|
160
160
|
})
|
|
161
161
|
})
|
|
@@ -174,11 +174,11 @@ describe('Strict Definitions', function () {
|
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
176
|
}
|
|
177
|
-
type
|
|
177
|
+
type S = StrictUnionTypeDef<null, U>
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
type C = UnionTypeDef<null, U>
|
|
180
180
|
it('equals type', function () {
|
|
181
|
-
expectTypeOf<C>().not.toMatchTypeOf(
|
|
181
|
+
expectTypeOf<C>().not.toMatchTypeOf<S>()
|
|
182
182
|
})
|
|
183
183
|
})
|
|
184
184
|
})
|
|
@@ -9,7 +9,7 @@ describe('TypeOfType', function () {
|
|
|
9
9
|
describe('literal', function () {
|
|
10
10
|
const literalType = numberType
|
|
11
11
|
type T = TypeOfType<typeof literalType>
|
|
12
|
-
|
|
12
|
+
type C = {
|
|
13
13
|
readonly definition: {
|
|
14
14
|
readonly type: TypeDefType.Literal,
|
|
15
15
|
readonly valuePrototype: [number],
|
|
@@ -17,7 +17,7 @@ describe('TypeOfType', function () {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
it('equals expected type', function () {
|
|
20
|
-
expectTypeOf<T>().toEqualTypeOf(
|
|
20
|
+
expectTypeOf<T>().toEqualTypeOf<C>()
|
|
21
21
|
})
|
|
22
22
|
})
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ describe('TypeOfType', function () {
|
|
|
25
25
|
describe('mutable', function () {
|
|
26
26
|
const listType = list(numberType)
|
|
27
27
|
type T = TypeOfType<typeof listType>
|
|
28
|
-
|
|
28
|
+
type C = {
|
|
29
29
|
readonly definition: {
|
|
30
30
|
readonly type: TypeDefType.List,
|
|
31
31
|
elements: {
|
|
@@ -35,13 +35,13 @@ describe('TypeOfType', function () {
|
|
|
35
35
|
},
|
|
36
36
|
}
|
|
37
37
|
it('equals expected type', function () {
|
|
38
|
-
expectTypeOf<T>().toEqualTypeOf(
|
|
38
|
+
expectTypeOf<T>().toEqualTypeOf<C>()
|
|
39
39
|
})
|
|
40
40
|
})
|
|
41
41
|
describe('readonly', function () {
|
|
42
42
|
const listType = list(numberType).readonlyElements()
|
|
43
43
|
type T = TypeOfType<typeof listType>
|
|
44
|
-
|
|
44
|
+
type C = {
|
|
45
45
|
readonly definition: {
|
|
46
46
|
readonly type: TypeDefType.List,
|
|
47
47
|
readonly elements: {
|
|
@@ -51,7 +51,7 @@ describe('TypeOfType', function () {
|
|
|
51
51
|
},
|
|
52
52
|
}
|
|
53
53
|
it('equals expected type', function () {
|
|
54
|
-
expectTypeOf<T>().toEqualTypeOf(
|
|
54
|
+
expectTypeOf<T>().toEqualTypeOf<C>()
|
|
55
55
|
})
|
|
56
56
|
})
|
|
57
57
|
})
|