- Introduced a new script to check TypeScript lesson files for errors. - Created a main TypeScript file to render lessons and their details. - Added lesson definitions with starter and answer codes. - Implemented a user interface for navigating and running lessons. - Styled the application with CSS for a better user experience. - Updated README to reflect the new TypeScript section and usage instructions.
练习 1:JavaScript 和 TypeScript 的差别
目标
理解 TypeScript 为什么能在写代码时提前发现类型问题。
你要练什么
- 参数类型
- 返回值类型
- 类型报错的意义
任务
- 观察
add函数的类型标注 - 看懂为什么
add(1, "2")会在 TypeScript 里报错