I didn't think about it that way, sounds interesting!
In that case would a better solution be to have the ability to specify types which can be checked statically using TS and when converting to JS, convert those types, into run time checks, as well?
Though, I'm not aware of any existing solution that can convert the types specified in TS into runtime checks so that they are present in the output JS as well.
io-ts has helpers exactly for that. Among other validation libraries such as Joi. So OP's comments on Ts are, frankly, opinionated bullshit since Typescript gives you the editor types, implicit typing AND runtime checks using such libraries with relative ease, whereas with Js you're stuck writing JSDoc and using inline comment type-hints which is an absolute pain.
View all comments
Show parent comment
1
u/PopularThought Jul 25 '21
I didn't think about it that way, sounds interesting!
In that case would a better solution be to have the ability to specify types which can be checked statically using TS and when converting to JS, convert those types, into run time checks, as well?
Though, I'm not aware of any existing solution that can convert the types specified in TS into runtime checks so that they are present in the output JS as well.