@每日英语3Understand That Code Generation Is Independent Of Types
- Code generation is independent of type system. This means that Typescript types cannot affect the runtime behavior or performance of your code.
- It is possible for a program with type errors to build code
- Typescript types are not available at runtime. To query a type at runtime, you need some way to reconstruct it. Tagged unions and property are common ways to do this. Some constructs, such as class, introduce both a Typescript type and a value that is available at runtime.
Know Which Typescript Options You're Using
- The Typescript compiler includes several settings which affect core aspects of the language
- TS 编译器包含了很多可以影响 ts 核心方面的设置
- Configure Typescript using tsconfig.json rather than command-line options
- 使用 tsconfig.json 来配置 TS 而不是命令行属性
- 除非你正在从JS 转移到 TS，否则打开 noImplicitAny 配置
- Use strictNullChecks to prevent "undefined is no an object" style runtime error
- 使用 strictNullChecks 配置来保护 "undefined 不是对象"这类型的运行时错误
- Aim to enable strict to get the most thorough checking that Typescript can offer
- 以 TS 能够提供的，可以使得项目能得到更严厉彻底的检测为目标；