Typescript Language Specification says:
Every JavaScript program is also a TypeScript program
Now consider this code:
var i = 5;
i = "five";
This is a perfectly valid javascript that will execute with no error. It is NOT a valid TypeScript, and it will fail to compile.
There is clearly mismatch in my understanding of the quoted statement above and the code example.
Could you please clarify, what makes the spec statement true in the context of the example I gave above.
Update
To address the argument that the statement does not reflect a program validity, let's rephrase it this way:
Every JavaScript program is also a valid or invalid TypeScript program
or
Every JavaScript program is not necessarily a valid TypeScript program
If the authors wanted to say the latter, why did not they say that?
var i: any = 5;once and the statement wasn’t updated as the language was? (Or maybe I’m just misremembering.)Every JavaScript "program" is also a TypeScript "program"but not necessarily a VALID TypeScript "program"