File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -1721,7 +1721,7 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
17211721 const _normalized = util . cached ( ( ) => {
17221722 const keys = Object . keys ( def . shape ) ;
17231723 for ( const k of keys ) {
1724- if ( ! ( def . shape [ k ] instanceof $ZodType ) ) {
1724+ if ( ! def . shape [ k ] . _zod . traits . has ( " $ZodType" ) ) {
17251725 throw new Error ( `Invalid element at key "${ k } ": expected a Zod schema` ) ;
17261726 }
17271727 }
@@ -3642,7 +3642,8 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
36423642 $ZodType . init ( inst , def ) ;
36433643 const regexParts : string [ ] = [ ] ;
36443644 for ( const part of def . parts ) {
3645- if ( part instanceof $ZodType ) {
3645+ if ( typeof part === "object" && part !== null ) {
3646+ // is Zod schema
36463647 if ( ! part . _zod . pattern ) {
36473648 // if (!source)
36483649 throw new Error ( `Invalid template literal part, no pattern found: ${ [ ...( part as any ) . _zod . traits ] . shift ( ) } ` ) ;
Original file line number Diff line number Diff line change @@ -2,16 +2,12 @@ import { z } from "zod/v4";
22
33z ;
44
5- console . log (
6- z
7- . object ( {
8- a : z . string ( ) ,
9- } )
10- . transform ( ( data ) => {
11- return {
12- ...data ,
13- tx : true ,
14- } ;
15- } )
16- . safeParse ( { a : "1" } )
17- ) ;
5+ // import { z } from "zod";
6+ const BrandedSchema = z . string ( ) . brand < "brand" > ( ) ;
7+ const WrappedSchema = z . object ( { key : BrandedSchema } ) ;
8+
9+ type bso = typeof BrandedSchema . _output ;
10+ type basdfasdfso = typeof BrandedSchema . _zod . output ;
11+ type wso = ( typeof WrappedSchema . _output ) [ "key" ] ;
12+ type bso2 = z . output < typeof BrandedSchema > ;
13+ type wso2 = z . output < typeof WrappedSchema > [ "key" ] ;
You can’t perform that action at this time.
0 commit comments