DEV Community

Korey Moffett
Korey Moffett

Posted on

JavaScript or TypeScript first?

I have some JavaScript knowledge and lately I’ve been seeing a lot of talk about TypeScript and how amazing it is(I’ve never used it so I’m not sure) is it something I should learn before or after JavaScript? Or do I even really need to learn it
(I would like to do web development)

Discussion (17)

Collapse
shadowtime2000 profile image
shadowtime2000

Learn it after Javascript. All Typescript is is an extension of Javascript to add some static type checking to avoid runtime errors. You don't need to learn it at all, in many cases Javascript is just enough. When you have something that is a little more complex with some messy code you may want to look into Typescript then.

Collapse
dewaldels profile image
Dewald Els

I would like to echo this statement. JavaScript should be the foundation web developers learn. Before react, angular, Vue, Svelte (insert tomorrow’s new framework) and even before TypeScript.

Understanding the fundamentals will make you a better developer in any framework 💪

Collapse
koreymoffett profile image
Korey Moffett Author

Thank you, I will keep that in mind.

Collapse
jwp profile image
John Peters • Edited on

If you learn Typescript first you will automatically know both. The only difference in getting started is whether or not Type annotations are used. For example:

//typescript and javascript are the same here, in both cases test is a default type on any
let test;
//this is typescript saying that test is a string.
let test:string;
Enter fullscreen mode Exit fullscreen mode

Of course , later on there's other advantages to use Typescript but that's a different topic.

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

Know some JavaScript; but consider not only TypeScript, but also something else, like Babel/Flow, Kotlin/JS or Transcypt; or any other variants.

TypeScript is not the only one.

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

Don't forget to use // @ts-check, though.

Anyways, having to always write interface in @typedef is hell.

Collapse
davidmaceachern profile image
David MacEachern

Have you looked inside the node_modules folder?

Collapse
noprod profile image
NOPROD ☄️ • Edited on

Don't scare him with this folder haha

But yes you need to check :p

Collapse
koolkishan profile image
Kishan Sheth

Master the fundamentals of JS first. Then search why to use TS. If you feel that TS would be beneficial to you then only learn it. At the end TS code get's compiled to JS only.
JS => Javascript
TS => Typescript

Collapse
zenbeni profile image
Benjamin Houdu

TypeScript has more features and of course types, can be used in the same environments as JavaScript, so no downsides to use it in place of JavaScript except a more complex build pipeline. It adds more compile checks, and better maintainability in the long run, which is something so important for big projects that are going to live long.

Java developpers for instance love TypeScript more than JavaScript for most I've seen. The Deno runtime supports TypeScript natively, Terraform CDK for TS, Github actions in TS, it is going te be first citizen in many techs now.

At the end of the day, if you get used to use types, I personally think you would not go back to JavaScript once you use TypeScript.

Collapse
janseniter profile image
Erick Jansen

JS first, TS later.

Collapse
onurgumus profile image
Onur Gumus

Use F# instead: fable.io/repl/ better than both.

Collapse
tehaisperlis profile image
Hazmi Irfan

Learn Javascript first so that you know what problem TypeScript is trying to solve.

Collapse
jonrandy profile image
Jon Randy

JavaScript first, TypeScript never :P

Collapse
zhnedyalkow profile image
Zhitomir Oreshenski

Js is a good start, basically vanilla js I recommend.