News for hackers. Stuff that matters.
Re:TypeScript please give us types by lolinder on Friday July 07, 2023 @05:05PM (#36638280)
It would violate #9 no matter what implementation you use, and #9 is absolutely essential to tools like ESBuild, Deno, and Bun, which all rely on the assumption that they can nearly instantly strip out the type annotations and execute the code as JS.
Re:TypeScript please give us types by wvenable on Friday July 07, 2023 @05:10PM (#36638340)
You'd still be able to execute the code as JS. Your library that uses type reflection wouldn't work anymore but that's true of all these solutions.
Re:TypeScript please give us types by lolinder on Friday July 07, 2023 @05:12PM (#36638368)
No, it's not. I can take a library that uses zod, strip the annotations, and it will execute perfectly anywhere I want to run it.
Re:TypeScript please give us types by wvenable on Friday July 07, 2023 @05:19PM (#36638443)
That's because Zod doesn't use type annotations as input. We're talking about wanting to use type annotations as input so that we don't have to make our code as ugly as Zod makes it.