leponceau.org

Programming And Stuff, You Know The Thing…

Javascript type-safety without TypeScript

Posted at — Apr 27, 2021
//@ts-check (not needed)

Example project:

https://github.com/jjYBdx4IL/ajax-solnotes

For VSCode we just need a tsconfig.json (tslint.json, too?) in the project’s root and configure the included files appropriately. And then use a .d.ts file to declare external types for which we don’t get type information via npm i @types/<pkgname> --save-dev. Or we can just put a //@ts-ignore above a specific code line of the checker is wrong.