Closed michaelneu closed 7 years ago
This is new behaviour in TS 2.1 outlined here. You can also see the type of 10 if you hover over the variable name here (https://www.typescriptlang.org/play/#src=const%20c%20%3D%2010%3B).
On first glance, I'm going to say we should go with the change the typescript team made.
Thanks for your quick answer.
You're right, the choice of the typescript team seems logical, thus changing the behaviour here would be odd. Closing as "intended behaviour".
The implicit type of
const
variables yields the initialization value of the variable:main.ts
Output with
typescript@2.1.4
andts-type-info@6.2.1
This might be due to changes in the compiler API from TypeScript 2.0.10 to 2.1.1.
npm install ts-type-info
installed the latest version (2.1.4), which led to the output above. When uninstalling typescript, and manually installing 2.0.10, the output will look as follows:Output with
typescript@2.0.10
andts-type-info@6.2.1
I don't know what this change might be yet, but if you want, I can take a look into it by the end of next week.