这个项目的前端框架使用的是react,并且选择了typescript
为什么要使用typescript,给出了一些观点:
优点:
1. Strong typing:
所有的我们使用在我们client side 的 app都会有一个type。
所以我们的编译器会识别出如果我们使用了错误的type。
And our code editor or ide will recognize that if we make silly mistakes.
IDE 会直观的给出我们如果犯了错误,例如把一个string去赋值到一个number类型的变量。
For example, if we are trying to assign a string to a number, it's going to give us a warning in our IDE as we are typing the code.
2. Objected oritented
It's better than the pure script.
3. Better intellisense 智能感知
如果你使用了面向对象在你的typescript中,我们会得到很好的智能感知和例如在ide中的自动填充功能。
If we use and create objects inside typescripte, we're going to get excellent intellisense and autocomplete in our code editor or IDE.
4. Access modifiers
可以让一个类是private或者public。但实际上,任何typescript在最终编译的时候,都会转化为js,并且这些类的类型都会被移除。所以说其实在开发过程中能够起到最用而已。