3 ms·
To be honest, just having a defined, literal type is not going far enough. Is there a built in language strategy, in Rust for example, to define a complex nume
by sbr464 8y ago
To be honest, just having a defined, literal type is not going far enough.
Is there a built in language strategy, in Rust for example, to define a complex numerical type that has common properties like min/max range, exclusive min/max, conditionally required logic etc?
Of course you can put some custom checks/logic to validate, but not sure why people instantly shame json-schema. From a validation perspective (not tooling) typescript is simplistic compared to a reusable, extended json schema.
It may be a matter of time for other js/ts tools to improve. I’ve been learning Rust and I haven’t seen a better solution currently for runtime/user input validation. (Not a c/rust expert by any means)
- steveklabnik 8y agoCurrently, you do runtime checks. We’ve accepted an RFC for integer generics that will let you do compile-time checks instead, but we’re still working on an implementation.
- sbr464 8y agoThanks Steve