上QQ阅读APP看书,第一时间看更新
Variable typing
In vanilla JavaScript, we would do something like this:
x = 20;
// after a few meaningful minutes
x = 'nah! It's not a number any more';
But in TypeScript, we cannot do as shown in the preceding code snippet, the TypeScript compiler would complain as we are modifying the variable type at runtime.