this post was submitted on 15 Aug 2023
13 points (93.3% liked)

No Stupid Questions (Developer Edition)

896 readers
1 users here now

This is a place where you can ask any programming / topic related to the instance questions you want!

For a more general version of this concept check out [email protected]

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

Do I master Typescript if I master Javascript ? Is Typescript syntax different ? Answers appreciated, thank you !

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 1 year ago (1 children)

TypeScript is a superset of JavaScript. It means any valid JavaScript is also valid TypeScript.

You should start to learn basic JavaScript mechanisms : prototype inheritance, hoisting, scopes, this, event loop, type coercion.

Once « JavaScript » sounds familiar you will embrace TypeScript which is JavaScript with steroids!

[–] [email protected] -4 points 1 year ago (2 children)

TypeScript is a superset of JavaScript. It means any valid JavaScript is also valid TypeScript.

This is backwards. JS is superset and all TS compiles to valid JS.

The vast majority of JS does not translate to Typescript as the JS is untyped.

[–] [email protected] 5 points 1 year ago

You don’t need to necessarily believe me but please double check your claims before you spread misinformation

[–] [email protected] 4 points 1 year ago (1 children)

To be a superset, all elements of the subset must be contained within the superset.

TypeScript is a superset of JavaScript as valid JS code(just with everything implicitly the any type) is valid TS code.

[–] [email protected] 0 points 1 year ago* (last edited 1 year ago)

Oh yeah if you add some sort of typing to the Javascript, sure.