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
[–] flurry 6 points 10 months ago (4 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!

[–] nbafantest -4 points 10 months ago (3 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] 4 points 10 months 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.

[–] nbafantest 0 points 10 months ago* (last edited 10 months ago)

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

load more comments (1 replies)
load more comments (1 replies)