@@ -787,3 +787,43 @@ test("isPlainObject", () => {
787
787
expect ( z . core . util . isPlainObject ( 123 ) ) . toEqual ( false ) ;
788
788
expect ( z . core . util . isPlainObject ( Symbol ( ) ) ) . toEqual ( false ) ;
789
789
} ) ;
790
+
791
+ test ( "def typing" , ( ) => {
792
+ z . string ( ) . def . type satisfies "string" ;
793
+ z . number ( ) . def . type satisfies "number" ;
794
+ z . bigint ( ) . def . type satisfies "bigint" ;
795
+ z . boolean ( ) . def . type satisfies "boolean" ;
796
+ z . date ( ) . def . type satisfies "date" ;
797
+ z . symbol ( ) . def . type satisfies "symbol" ;
798
+ z . undefined ( ) . def . type satisfies "undefined" ;
799
+ z . string ( ) . nullable ( ) . def . type satisfies "nullable" ;
800
+ z . null ( ) . def . type satisfies "null" ;
801
+ z . any ( ) . def . type satisfies "any" ;
802
+ z . unknown ( ) . def . type satisfies "unknown" ;
803
+ z . never ( ) . def . type satisfies "never" ;
804
+ z . void ( ) . def . type satisfies "void" ;
805
+ z . array ( z . string ( ) ) . def . type satisfies "array" ;
806
+ z . object ( { key : z . string ( ) } ) . def . type satisfies "object" ;
807
+ z . union ( [ z . string ( ) , z . number ( ) ] ) . def . type satisfies "union" ;
808
+ z . intersection ( z . string ( ) , z . number ( ) ) . def . type satisfies "intersection" ;
809
+ z . tuple ( [ z . string ( ) , z . number ( ) ] ) . def . type satisfies "tuple" ;
810
+ z . record ( z . string ( ) , z . number ( ) ) . def . type satisfies "record" ;
811
+ z . map ( z . string ( ) , z . number ( ) ) . def . type satisfies "map" ;
812
+ z . set ( z . string ( ) ) . def . type satisfies "set" ;
813
+ z . literal ( "example" ) . def . type satisfies "literal" ;
814
+ z . enum ( [ "a" , "b" , "c" ] ) . def . type satisfies "enum" ;
815
+ z . promise ( z . string ( ) ) . def . type satisfies "promise" ;
816
+ z . lazy ( ( ) => z . string ( ) ) . def . type satisfies "lazy" ;
817
+ z . string ( ) . optional ( ) . def . type satisfies "optional" ;
818
+ z . string ( ) . default ( "default" ) . def . type satisfies "default" ;
819
+ z . templateLiteral ( [ z . literal ( "a" ) , z . literal ( "b" ) ] ) . def . type satisfies "template_literal" ;
820
+ z . custom < string > ( ( val ) => typeof val === "string" ) . def . type satisfies "custom" ;
821
+ z . transform ( ( val ) => val as string ) . def . type satisfies "transform" ;
822
+ z . string ( ) . optional ( ) . nonoptional ( ) . def . type satisfies "nonoptional" ;
823
+ z . object ( { key : z . string ( ) } ) . readonly ( ) . def . type satisfies "readonly" ;
824
+ z . nan ( ) . def . type satisfies "nan" ;
825
+ z . unknown ( ) . pipe ( z . number ( ) ) . def . type satisfies "pipe" ;
826
+ z . success ( z . string ( ) ) . def . type satisfies "success" ;
827
+ z . string ( ) . catch ( "fallback" ) . def . type satisfies "catch" ;
828
+ z . file ( ) . def . type satisfies "file" ;
829
+ } ) ;
0 commit comments