- 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.
11 lines
265 B
TypeScript
11 lines
265 B
TypeScript
function add(a: number, b: number): number {
|
||
return a + b;
|
||
}
|
||
|
||
const result = add(1, 2);
|
||
console.log(result);
|
||
|
||
// const wrongResult = add(1, "2");
|
||
// TypeScript 会在写代码阶段直接提示:
|
||
// 第二个参数应该是 number,但这里传入了 string。
|