Typescript typing without Typescript

· rrees's blog


Transpilation or code modification is generally the pits. Using Typescript can often be a real pain due to the need to transform it into Javascript to be able to use it with other tools (and ultimately run it).

For hobby projects I don't think it is worth the pain and would either use regular Javascript or an environment like Deno or maybe integrated tooling like Bun.

When I choose regular Javascript though I do think that it is handy to be able to define and validate interfaces and validate class usage.

Rather than building a tool chain you can actually achieve that just with JSDoc and the Typescript compiler.

Here are some excellent guides to getting type validation while keeping all your code and tooling vanilla Javascript.