Message from JavaScript discussions

November 2020

— It normally requires a bit of setup, for a jquery project I would recommend doing something like this:

npm i -D typescript
npm i -g typescript
create a tsconfig.json file (lookup how to do this)
then you're set, and you can just do:
tsc file.ts
and it will create a file.js for you

Message permanent page


With a tsconfig file you can just run:
tsc in your project folder, and it will compile all files specified in tsconfig.json

— I have no Server connection btw.

All pure front end

— That's fine

— Oh I get it

— I create a local .ts file and it gets converted Into javascript

— Yep

— TypeScript files can't really "execute", they must be compiled into JavaScript first

— But in the process of translating, all the types also get checked for errors

— And if you're using a fancy editor, this can also happen while you are editing

— If I don't use TS, is the webapp prone to errors or hackers or both ?

— I would say more prone to errors, particularly what we call "type errors"