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);
26
26
27
27
console . log ( "Extensible tool keeps ALL properties:" ) ;
28
28
console . 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"
30
31
31
32
// With safe types - unknown fields are silently stripped
32
33
const safeTool = ToolSchema . parse ( toolData ) ;
33
34
34
35
console . 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