TS 定义函数的可选参数类型 index.ts function foo(name: string, age?: number) { console.log(name + age); } foo("a"); // "aundefined"