3 ms·
Also there's one feature that deno could make possible given their tight integration: Allow JSON.parse to use typescript types. So I can parse JSON with suppl
by vbezhenar 3y ago
Also there's one feature that deno could make possible given their tight integration:
Allow JSON.parse to use typescript types.
So I can parse JSON with supplied type and engine would validate JSON against that type. Simple as that.
Also might be useful for JSON.serialize to have an output control (because TypeScript could be abused and actual value might differ from its type).
This simple feature would bring tremendous value to application stability IMO.
- emadda 3y agoI have been using zod to create validation functions. The validation functions give the TS compiler hints about the types that are output after validation. I think you either: (1) start with the runtime code and derive the types (what TS does by default). or (2) start with the types and derive the runtime code (like "macros" in some languages). Does anyone have any suggestions for the best way to do this in a Node runtime?