相关疑难解决方法(0)

如何在TypeScript中将类型声明为可为空?

我在TypeScript中有一个接口.

interface Employee{
   id: number;
   name: string;
   salary: number;
}
Run Code Online (Sandbox Code Playgroud)

我想把'薪水'作为一个可以为空的领域(就像我们在C#中所做的那样).这可以在TypeScript中做到吗?

javascript typescript

202
推荐指数
9
解决办法
20万
查看次数

标签 统计

javascript ×1

typescript ×1