File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1042,4 +1042,34 @@ Right: { foo: (In: string) => Out<{ [string]: $jsonObject | number | string | fa
10421042 attest < number > ( t . morphed )
10431043 attest < number | undefined > ( t . nested ?. morphed )
10441044 } )
1045+
1046+ it ( "complex morphs are applied on correct path" , ( ) => {
1047+ let c : null | 1
1048+
1049+ const M = type ( {
1050+ list : type ( "object" )
1051+ . pipe ( e => e )
1052+ . pipe (
1053+ type ( {
1054+ z : type ( "unknown" ) . pipe ( ( ) => c )
1055+ } )
1056+ )
1057+ . array ( ) ,
1058+ _ : [ "unknown" , ":" , ( ) => true ]
1059+ } )
1060+
1061+ c = null
1062+ attest ( ( ) =>
1063+ M ( {
1064+ list : [ { z : "" } , { z : "" } ]
1065+ } ) . toString ( )
1066+ ) . throws . snap ( "TypeError: Cannot read properties of null (reading 'z')" )
1067+
1068+ c = 1
1069+ attest ( ( ) =>
1070+ M ( {
1071+ list : [ { z : "" } , { z : "" } ]
1072+ } ) . toString ( )
1073+ ) . throws . snap ( "TypeError: Cannot create property 'z' on number '1'" )
1074+ } )
10451075} )
You can’t perform that action at this time.
0 commit comments