▲ | dwattttt 3 days ago | |
The type isn't just there to make it easy to understand when you do it, it's for you a year later when you need to make a change further inside a codebase, far from where it's validated. Or for someone else who's never even seen the validation section of code. I'm hung up on the type system because it's a great way to convey the validity of the data; it follows the data around as it flows through your program. I don't (yet) Typescript, but jsdoc and linting give me enough type checking for my needs. | ||
▲ | hdjrudni 6 hours ago | parent | next [-] | |
Don't get me wrong, I love TypeScript types. And if I didn't have TypeScript, I'd use jsdoc. I'm just saying that TypeScript and jsdoc don't actually do any runtime enforcement. It's important that the library does that part, with or without types. | ||
▲ | k3vinw 3 days ago | parent | prev [-] | |
jsdoc types are better than nothing. You could switch to using Typescript today and it will understand them. |