@@ -46,7 +46,7 @@ export const FOO = t.number;
4646` ;
4747
4848testCase ( 'simple codec is parsed' , SIMPLE , {
49- FOO : { type : 'number' } ,
49+ FOO : { type : 'number' , primitive : true } ,
5050} ) ;
5151
5252const DIRECT = `
@@ -55,7 +55,7 @@ export const FOO = number;
5555` ;
5656
5757testCase ( 'direct import is parsed' , DIRECT , {
58- FOO : { type : 'number' } ,
58+ FOO : { type : 'number' , primitive : true } ,
5959} ) ;
6060
6161const TYPE = `
@@ -66,7 +66,7 @@ export const FOO = t.type({ foo: t.number });
6666testCase ( 'type is parsed' , TYPE , {
6767 FOO : {
6868 type : 'object' ,
69- properties : { foo : { type : 'number' } } ,
69+ properties : { foo : { type : 'number' , primitive : true } } ,
7070 required : [ 'foo' ] ,
7171 } ,
7272} ) ;
@@ -79,7 +79,7 @@ export const FOO = t.partial({ foo: t.number });
7979testCase ( 'partial type is parsed' , PARTIAL , {
8080 FOO : {
8181 type : 'object' ,
82- properties : { foo : { type : 'number' } } ,
82+ properties : { foo : { type : 'number' , primitive : true } } ,
8383 required : [ ] ,
8484 } ,
8585} ) ;
@@ -91,10 +91,10 @@ export const FOO = t.type({ bar });
9191` ;
9292
9393testCase ( 'shorthand property is parsed' , SHORTHAND_PROPERTY , {
94- bar : { type : 'number' } ,
94+ bar : { type : 'number' , primitive : true } ,
9595 FOO : {
9696 type : 'object' ,
97- properties : { bar : { type : 'number' } } ,
97+ properties : { bar : { type : 'number' , primitive : true } } ,
9898 required : [ 'bar' ] ,
9999 } ,
100100} ) ;
@@ -110,14 +110,14 @@ export const TEST = t.type({ ...foo, bar: t.string });
110110testCase ( 'spread property is parsed' , SPREAD_PROPERTY , {
111111 foo : {
112112 type : 'object' ,
113- properties : { foo : { type : 'number' } } ,
113+ properties : { foo : { type : 'number' , primitive : true } } ,
114114 required : [ 'foo' ] ,
115115 } ,
116116 TEST : {
117117 type : 'object' ,
118118 properties : {
119- foo : { type : 'number' } ,
120- bar : { type : 'string' } ,
119+ foo : { type : 'number' , primitive : true } ,
120+ bar : { type : 'string' , primitive : true } ,
121121 } ,
122122 required : [ 'foo' , 'bar' ] ,
123123 } ,
@@ -132,12 +132,12 @@ export const FOO = t.type(props);
132132testCase ( 'const assertion is parsed' , CONST_ASSERTION , {
133133 FOO : {
134134 type : 'object' ,
135- properties : { foo : { type : 'number' } } ,
135+ properties : { foo : { type : 'number' , primitive : true } } ,
136136 required : [ 'foo' ] ,
137137 } ,
138138 props : {
139139 type : 'object' ,
140- properties : { foo : { type : 'number' } } ,
140+ properties : { foo : { type : 'number' , primitive : true } } ,
141141 required : [ 'foo' ] ,
142142 } ,
143143} ) ;
@@ -153,12 +153,12 @@ export const FOO = t.type({
153153testCase ( 'spread const assertion is parsed' , SPREAD_CONST_ASSERTION , {
154154 FOO : {
155155 type : 'object' ,
156- properties : { foo : { type : 'number' } } ,
156+ properties : { foo : { type : 'number' , primitive : true } } ,
157157 required : [ 'foo' ] ,
158158 } ,
159159 props : {
160160 type : 'object' ,
161- properties : { foo : { type : 'number' } } ,
161+ properties : { foo : { type : 'number' , primitive : true } } ,
162162 required : [ 'foo' ] ,
163163 } ,
164164} ) ;
@@ -172,12 +172,12 @@ export const FOO = t.type(props);
172172testCase ( 'as assertion is parsed' , AS_ASSERTION , {
173173 FOO : {
174174 type : 'object' ,
175- properties : { foo : { type : 'number' } } ,
175+ properties : { foo : { type : 'number' , primitive : true } } ,
176176 required : [ 'foo' ] ,
177177 } ,
178178 props : {
179179 type : 'object' ,
180- properties : { foo : { type : 'number' } } ,
180+ properties : { foo : { type : 'number' , primitive : true } } ,
181181 required : [ 'foo' ] ,
182182 } ,
183183} ) ;
@@ -193,12 +193,12 @@ export const FOO = t.type({
193193testCase ( 'spread const assertion is parsed' , SPREAD_AS_ASSERTION , {
194194 FOO : {
195195 type : 'object' ,
196- properties : { foo : { type : 'number' } } ,
196+ properties : { foo : { type : 'number' , primitive : true } } ,
197197 required : [ 'foo' ] ,
198198 } ,
199199 props : {
200200 type : 'object' ,
201- properties : { foo : { type : 'number' } } ,
201+ properties : { foo : { type : 'number' , primitive : true } } ,
202202 required : [ 'foo' ] ,
203203 } ,
204204} ) ;
@@ -209,7 +209,7 @@ export const FOO = t.array(t.number);
209209` ;
210210
211211testCase ( 'array type is parsed' , ARRAY , {
212- FOO : { type : 'array' , items : { type : 'number' } } ,
212+ FOO : { type : 'array' , items : { type : 'number' , primitive : true } } ,
213213} ) ;
214214
215215const UNION = `
@@ -220,7 +220,7 @@ export const FOO = t.union([t.string, t.number]);
220220testCase ( 'union type is parsed' , UNION , {
221221 FOO : {
222222 type : 'union' ,
223- schemas : [ { type : 'string' } , { type : 'number' } ] ,
223+ schemas : [ { type : 'string' , primitive : true } , { type : 'number' , primitive : true } ] ,
224224 } ,
225225} ) ;
226226
@@ -235,11 +235,11 @@ export const FOO = t.union([...common, t.number]);
235235testCase ( 'union type with spread is parsed' , UNION_SPREAD , {
236236 FOO : {
237237 type : 'union' ,
238- schemas : [ { type : 'string' } , { type : 'number' } ] ,
238+ schemas : [ { type : 'string' , primitive : true } , { type : 'number' , primitive : true } ] ,
239239 } ,
240240 common : {
241241 type : 'tuple' ,
242- schemas : [ { type : 'string' } ] ,
242+ schemas : [ { type : 'string' , primitive : true } ] ,
243243 } ,
244244} ) ;
245245
@@ -252,7 +252,7 @@ export const FOO = t.union([...[t.string], t.number]);
252252testCase ( 'union type with inline spread is parsed' , UNION_INLINE_SPREAD , {
253253 FOO : {
254254 type : 'union' ,
255- schemas : [ { type : 'string' } , { type : 'number' } ] ,
255+ schemas : [ { type : 'string' , primitive : true } , { type : 'number' , primitive : true } ] ,
256256 } ,
257257} ) ;
258258
@@ -267,12 +267,12 @@ testCase('intersection type is parsed', INTERSECTION, {
267267 schemas : [
268268 {
269269 type : 'object' ,
270- properties : { foo : { type : 'number' } } ,
270+ properties : { foo : { type : 'number' , primitive : true } } ,
271271 required : [ 'foo' ] ,
272272 } ,
273273 {
274274 type : 'object' ,
275- properties : { bar : { type : 'string' } } ,
275+ properties : { bar : { type : 'string' , primitive : true } } ,
276276 required : [ ] ,
277277 } ,
278278 ] ,
@@ -285,7 +285,7 @@ export const FOO = t.record(t.string, t.number);
285285` ;
286286
287287testCase ( 'record type is parsed' , RECORD , {
288- FOO : { type : 'record' , codomain : { type : 'number' } } ,
288+ FOO : { type : 'record' , codomain : { type : 'number' , primitive : true } } ,
289289} ) ;
290290
291291const ENUM = `
@@ -381,7 +381,7 @@ export const FOO = test;
381381` ;
382382
383383testCase ( 'aliased import is parsed' , ALIAS , {
384- FOO : { type : 'string' } ,
384+ FOO : { type : 'string' , primitive : true } ,
385385} ) ;
386386
387387const BRAND = `
@@ -394,7 +394,7 @@ export const FOO = t.brand(t.string, (s): s is FooBranded => s === 'foo', 'Foo')
394394` ;
395395
396396testCase ( 'brand type is parsed' , BRAND , {
397- FOO : { type : 'string' } ,
397+ FOO : { type : 'string' , primitive : true } ,
398398} ) ;
399399
400400const LOCAL_REF = `
@@ -406,7 +406,7 @@ export const BAR = t.type({ bar: FOO });
406406testCase ( 'local ref is parsed' , LOCAL_REF , {
407407 FOO : {
408408 type : 'object' ,
409- properties : { foo : { type : 'number' } } ,
409+ properties : { foo : { type : 'number' , primitive : true } } ,
410410 required : [ 'foo' ] ,
411411 } ,
412412 BAR : {
@@ -425,7 +425,7 @@ export const BAR = t.type({ bar: FOO });
425425testCase ( 'local exported ref is parsed' , LOCAL_EXPORTED_REF , {
426426 FOO : {
427427 type : 'object' ,
428- properties : { foo : { type : 'number' } } ,
428+ properties : { foo : { type : 'number' , primitive : true } } ,
429429 required : [ 'foo' ] ,
430430 } ,
431431 BAR : {
@@ -476,6 +476,7 @@ export const FOO = t.number;
476476testCase ( 'declaration comment is parsed' , DECLARATION_COMMENT , {
477477 FOO : {
478478 type : 'number' ,
479+ primitive : true ,
479480 comment : {
480481 description : 'Test codec' ,
481482 tags : [ ] ,
@@ -553,7 +554,8 @@ testCase(
553554 DECLARATION_COMMENT_WITHOUT_LINE_BREAK ,
554555 {
555556 FOO : {
556- type : 'number' ,
557+ type : 'number' ,
558+ primitive : true ,
557559 comment : {
558560 description : 'Test codec' ,
559561 tags : [ ] ,
@@ -633,6 +635,7 @@ testCase('first property comment is parsed', FIRST_PROPERTY_COMMENT, {
633635 properties : {
634636 foo : {
635637 type : 'number' ,
638+ primitive : true ,
636639 comment : {
637640 description : 'this is a comment' ,
638641 problems : [ ] ,
@@ -677,9 +680,10 @@ testCase('second property comment is parsed', SECOND_PROPERTY_COMMENT, {
677680 FOO : {
678681 type : 'object' ,
679682 properties : {
680- foo : { type : 'number' } ,
683+ foo : { type : 'number' , primitive : true } ,
681684 bar : {
682- type : 'string' ,
685+ type : 'string' ,
686+ primitive : true ,
683687 comment : {
684688 description : 'this is a comment' ,
685689 problems : [ ] ,
@@ -720,7 +724,7 @@ export const FOO = h.optional(t.string);
720724testCase ( 'optional combinator is parsed' , OPTIONAL_COMBINATOR , {
721725 FOO : {
722726 type : 'union' ,
723- schemas : [ { type : 'string' } , { type : 'undefined' } ] ,
727+ schemas : [ { type : 'string' , primitive : true } , { type : 'undefined' } ] ,
724728 } ,
725729} ) ;
726730
@@ -737,10 +741,10 @@ testCase('optionalized combinator is parsed', OPTIONALIZED_COMBINATOR, {
737741 FOO : {
738742 type : 'object' ,
739743 properties : {
740- foo : { type : 'string' } ,
744+ foo : { type : 'string' , primitive : true } ,
741745 bar : {
742746 type : 'union' ,
743- schemas : [ { type : 'number' } , { type : 'undefined' } ] ,
747+ schemas : [ { type : 'number' , primitive : true } , { type : 'undefined' } ] ,
744748 } ,
745749 } ,
746750 required : [ 'foo' ] ,
@@ -766,15 +770,15 @@ testCase('httpRequest combinator is parsed', HTTP_REQUEST_COMBINATOR, {
766770 properties : {
767771 params : {
768772 type : 'object' ,
769- properties : { foo : { type : 'string' } } ,
773+ properties : { foo : { type : 'string' , primitive : true } } ,
770774 required : [ 'foo' ] ,
771775 } ,
772776 query : {
773777 type : 'object' ,
774778 properties : {
775779 bar : {
776780 type : 'union' ,
777- schemas : [ { type : 'number' } , { type : 'undefined' } ] ,
781+ schemas : [ { type : 'number' , primitive : true } , { type : 'undefined' } ] ,
778782 } ,
779783 } ,
780784 required : [ ] ,
@@ -801,15 +805,15 @@ testCase('object property is parsed', OBJECT_PROPERTY, {
801805 FOO : {
802806 type : 'object' ,
803807 properties : {
804- baz : { type : 'number' } ,
808+ baz : { type : 'number' , primitive : true } ,
805809 } ,
806810 required : [ 'baz' ] ,
807811 } ,
808812 props : {
809813 type : 'object' ,
810814 properties : {
811- foo : { type : 'number' } ,
812- bar : { type : 'string' } ,
815+ foo : { type : 'number' , primitive : true } ,
816+ bar : { type : 'string' , primitive : true } ,
813817 } ,
814818 required : [ 'foo' , 'bar' ] ,
815819 } ,
@@ -830,16 +834,16 @@ testCase('object assign is parsed', OBJECT_ASSIGN, {
830834 FOO : {
831835 type : 'object' ,
832836 properties : {
833- foo : { type : 'number' } ,
834- bar : { type : 'string' } ,
837+ foo : { type : 'number' , primitive : true } ,
838+ bar : { type : 'string' , primitive : true } ,
835839 } ,
836840 required : [ 'foo' , 'bar' ] ,
837841 } ,
838842 props : {
839843 type : 'object' ,
840844 properties : {
841- foo : { type : 'number' } ,
842- bar : { type : 'string' } ,
845+ foo : { type : 'number' , primitive : true } ,
846+ bar : { type : 'string' , primitive : true } ,
843847 } ,
844848 required : [ 'foo' , 'bar' ] ,
845849 } ,
0 commit comments