DEV Community

Cover image for How to Start Using Typescript

How to Start Using Typescript

Simon Pfeiffer on January 07, 2022

One of the most significant innovations in web development in the past decade has been the shift towards Typescript. As more and more employers are...
Collapse
 
karfau profile image
Christian Bewernitz

I would say that ! is as dangerous as as Xyz.

Basically you are saying: "I know what I'm doing, leave me alone."

But typescript only ever checks at compile time, never at runtime, so when you get back something else, a lot of assumptions in your code will go away.

It's better to check for undefined/null values if typescript tells you.

Which is also very convinient by using the operators introduced for that, like ?., ?? etc.

Collapse
 
uponthesky profile image
UponTheSky • Edited

Thanks for the good article.
I'm just wondering, that how you set up your own tsconfig.json?
It always gives me a big headache whenever I start my own ts-related projects or deploy them with Dockerfile.

I would like to listen to your opinion. Thanks!

Collapse
 
liorbd profile image
Lior Ben-David

Hi!

I tend to defer to Typescript's base configs. They have ones that you can take for vanilla JS, node, or react native projects:

typescriptlang.org/docs/handbook/t...

From there, I just adjust the config out of necessity, but these base configs tend to be sufficient.

Collapse
 
uponthesky profile image
UponTheSky

Thanks for the reply! Have a nice day!

Collapse
 
karfau profile image
Christian Bewernitz

I really like your careful introduction and it provides a way to use TS in the JS world.

But if you are curios about typescript without much hassle, try Deno.
It's really easy to get started and you don't have to transpile anything before being able to run TS code.
It even comes with a REPL ...

Collapse
 
simoncodephere profile image
Simon Pfeiffer

thanks for the feedback Christian! Much appreciated :)

Collapse
 
corinnedonon profile image
CorinneDonon

To run the TypeScript compiler, which one ran the npm command to install the TypeScript command on the terminal ?

surah taha for love marriage

Collapse
 
liorbd profile image
Lior Ben-David

Hi Corinne,

You can install typescript in an npm project with:

npm install typescript --save-dev

Collapse
 
jwp profile image
John Peters

Fantastic, 😊

Collapse
 
simoncodephere profile image
Simon Pfeiffer

Glad you enjoyed it!

Collapse
 
thenickest profile image
TheNickest

Nice :)

Collapse
 
gaurangjindal15 profile image
Gaurang jindal

Hello I am looking for a javascript and react js developer who can support in online hackathon which is going to conduct from 12th Jan.

In case you are interested please ping me. !!! its urgent !!!!

Collapse
 
johnb8005 profile image
John B • Edited

here's a typescript boilerplate for those wanting to try typescript quickly (<1min): github.com/nexys-system/boilerplat...

Collapse
 
api_patrol profile image
Pawel Duda

WHat does "!" mean here?

Collapse
 
nnivxix profile image
Hanasa

nice article for getting start using TS

Collapse
 
simoncodephere profile image
Simon Pfeiffer

thanks :)

Collapse
 
luizc91 profile image
LuizC91

These terminal commands can be used directly in the Windows Terminal? If not, how can I adapt it to run without any problem?