Message from JavaScript discussions

November 2020

— Or you can be more accurate:

let a: number | string = "hi";

— 

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

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

Message permanent page

— 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 ?