@strictly/define 0.0.5 → 0.0.7
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/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/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-check-types.log +1 -1
- package/package.json +1 -1
- 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
|
@@ -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
|
})
|
|
@@ -12,9 +12,9 @@ describe('ValueOfType', function () {
|
|
|
12
12
|
}
|
|
13
13
|
type T = ValueOfType<{ definition: TypeD }>
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
type C = 'a' | 'b' | 'c'
|
|
16
16
|
it('equals expected type', function () {
|
|
17
|
-
expectTypeOf(
|
|
17
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
18
18
|
})
|
|
19
19
|
})
|
|
20
20
|
|
|
@@ -29,9 +29,9 @@ describe('ValueOfType', function () {
|
|
|
29
29
|
}
|
|
30
30
|
type T = ValueOfType<{ definition: TypeD }>
|
|
31
31
|
describe('mutable', function () {
|
|
32
|
-
|
|
32
|
+
type C = ('a' | 'b' | 'c')[]
|
|
33
33
|
it('equals expected type', function () {
|
|
34
|
-
expectTypeOf(
|
|
34
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
35
35
|
})
|
|
36
36
|
})
|
|
37
37
|
|
|
@@ -46,9 +46,9 @@ describe('ValueOfType', function () {
|
|
|
46
46
|
},
|
|
47
47
|
}>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
type C = readonly ('a' | 'b' | 'c')[]
|
|
50
50
|
it('equals expected type', function () {
|
|
51
|
-
expectTypeOf(
|
|
51
|
+
expectTypeOf<C>().toEqualTypeOf<R>()
|
|
52
52
|
})
|
|
53
53
|
})
|
|
54
54
|
})
|
|
@@ -66,9 +66,9 @@ describe('ValueOfType', function () {
|
|
|
66
66
|
type T = ValueOfType<{ definition: TypeD }>
|
|
67
67
|
|
|
68
68
|
describe('mutable', function () {
|
|
69
|
-
|
|
69
|
+
type C = Record<'x' | 'y' | 'z', 'a' | 'b' | 'c'>
|
|
70
70
|
it('equals expected type', function () {
|
|
71
|
-
expectTypeOf(
|
|
71
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
72
72
|
})
|
|
73
73
|
})
|
|
74
74
|
|
|
@@ -83,10 +83,10 @@ describe('ValueOfType', function () {
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
}>
|
|
86
|
-
|
|
86
|
+
type C = Readonly<Record<'x' | 'y' | 'z', 'a' | 'b' | 'c'>>
|
|
87
87
|
|
|
88
88
|
it('equals expected type', function () {
|
|
89
|
-
expectTypeOf(
|
|
89
|
+
expectTypeOf<C>().toEqualTypeOf<R>()
|
|
90
90
|
})
|
|
91
91
|
})
|
|
92
92
|
|
|
@@ -101,9 +101,9 @@ describe('ValueOfType', function () {
|
|
|
101
101
|
}
|
|
102
102
|
type T = ValueOfType<{ definition: TypeD }>
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
type C = Partial<Record<'x' | 'y' | 'z', 'a' | 'b' | 'c'>>
|
|
105
105
|
it('equals expected type', function () {
|
|
106
|
-
expectTypeOf(
|
|
106
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
107
107
|
})
|
|
108
108
|
})
|
|
109
109
|
|
|
@@ -118,9 +118,9 @@ describe('ValueOfType', function () {
|
|
|
118
118
|
}
|
|
119
119
|
type T = ValueOfType<{ definition: TypeD }>
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
type C = Partial<Readonly<Record<'x' | 'y' | 'z', 'a' | 'b' | 'c'>>>
|
|
122
122
|
it('equals expected type', function () {
|
|
123
|
-
expectTypeOf(
|
|
123
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
124
124
|
})
|
|
125
125
|
})
|
|
126
126
|
})
|
|
@@ -142,13 +142,13 @@ describe('ValueOfType', function () {
|
|
|
142
142
|
type T = ValueOfType<{ definition: TypeD }>
|
|
143
143
|
|
|
144
144
|
describe('mutable', function () {
|
|
145
|
-
|
|
145
|
+
type C = {
|
|
146
146
|
a: 'a' | 'b',
|
|
147
147
|
b: number,
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
it('equals expected type', function () {
|
|
151
|
-
expectTypeOf(
|
|
151
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
152
152
|
})
|
|
153
153
|
})
|
|
154
154
|
|
|
@@ -168,12 +168,12 @@ describe('ValueOfType', function () {
|
|
|
168
168
|
}
|
|
169
169
|
type T = ValueOfType<{ definition: TypeD }>
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
type C = {
|
|
172
172
|
readonly a: 'a' | 'b',
|
|
173
173
|
readonly b: number,
|
|
174
174
|
}
|
|
175
175
|
it('equals expected type', function () {
|
|
176
|
-
expectTypeOf(
|
|
176
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
177
177
|
})
|
|
178
178
|
})
|
|
179
179
|
|
|
@@ -193,13 +193,13 @@ describe('ValueOfType', function () {
|
|
|
193
193
|
}
|
|
194
194
|
type T = ValueOfType<{ definition: TypeD }>
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
type C = {
|
|
197
197
|
a?: 'a' | 'b',
|
|
198
198
|
b?: number,
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
it('equals expected type', function () {
|
|
202
|
-
expectTypeOf(
|
|
202
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
203
203
|
})
|
|
204
204
|
})
|
|
205
205
|
})
|
|
@@ -227,10 +227,10 @@ describe('ValueOfType', function () {
|
|
|
227
227
|
},
|
|
228
228
|
}>
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
type C = null | number | string
|
|
231
231
|
|
|
232
232
|
it('equals expected type', function () {
|
|
233
|
-
expectTypeOf(
|
|
233
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
234
234
|
})
|
|
235
235
|
})
|
|
236
236
|
|
|
@@ -270,7 +270,7 @@ describe('ValueOfType', function () {
|
|
|
270
270
|
},
|
|
271
271
|
}>
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
type C = {
|
|
274
274
|
readonly d: 1,
|
|
275
275
|
b: string,
|
|
276
276
|
} | {
|
|
@@ -279,7 +279,7 @@ describe('ValueOfType', function () {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
it('equals expected type', function () {
|
|
282
|
-
expectTypeOf(
|
|
282
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
283
283
|
})
|
|
284
284
|
})
|
|
285
285
|
|
|
@@ -313,7 +313,7 @@ describe('ValueOfType', function () {
|
|
|
313
313
|
}>
|
|
314
314
|
>
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
type C = {
|
|
317
317
|
readonly d: 1,
|
|
318
318
|
b: string,
|
|
319
319
|
} | {
|
|
@@ -322,7 +322,7 @@ describe('ValueOfType', function () {
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
it('equals expected type', function () {
|
|
325
|
-
expectTypeOf(
|
|
325
|
+
expectTypeOf<C>().toEqualTypeOf<T>()
|
|
326
326
|
})
|
|
327
327
|
})
|
|
328
328
|
})
|