File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,12 @@ const extensibleTool = ExtensibleToolSchema.parse(toolData);
2626
2727console . log ( "Extensible tool keeps ALL properties:" ) ;
2828console . log ( "- name:" , extensibleTool . name ) ;
29- console . log ( "- customField:" , ( extensibleTool as any ) . customField ) ; // "This is an extension"
29+ // Type assertion to access the extra field
30+ console . log ( "- customField:" , ( extensibleTool as Record < string , unknown > ) . customField ) ; // "This is an extension"
3031
3132// With safe types - unknown fields are silently stripped
3233const safeTool = ToolSchema . parse ( toolData ) ;
3334
3435console . log ( "\nSafe tool strips unknown properties:" ) ;
35- console . log ( "- customField:" , ( safeTool as any ) . customField ) ; // undefined (stripped)
36+ // Type assertion to check the field was removed
37+ console . log ( "- customField:" , ( safeTool as Record < string , unknown > ) . customField ) ; // undefined (stripped)
You can’t perform that action at this time.
0 commit comments