DEV Community

Discussion on: JavaScript Type Checking... Without TypeScript

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

The real problem is not TypeScript is not type-safe, but many validation libraries was not made with IDE friendliness in mind.

TypeScript is as type-safe as IDE can be (might be in actuality lower than that), but we can always raise the bar.

I currently use JSON-schema-based jsonschema-definer. (Used to use zod.) JSON schema definitions are quite vast and well written, as well as work well with Swagger. JSON schema as well as Swagger are supposed to be cross language as well. The library also extended it with .custom() function as in case.