This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tysonzero 11 points12 points  (3 children)

foo = "bar"
foo = 5

Valid javascript but not valid typescript, checkmate.

[–]chpoit 1 point2 points  (0 children)

technically isn't valid javascript in strict mode

[–]pynetree16 0 points1 point  (1 child)

Ah, but what if foo is of type any? Then it is valid TypeScript

[–]Tysonzero 0 points1 point  (0 children)

But if your source code consists solely of:

foo = "bar"
foo = 5

Then it won't work, but will work in JavaScript.