在 TypeScript 中,你可以在函数参数的定义中直接给参数设定默认值。下面是一个示例: function greet(name: string = 'Guest'): string { return `Hello, ${name}!` } console.log(greet()) //..