我有一个Employees typescript接口:
export interface Employees {
[employeeId: string]: {
name: string
gender: Gender
}
}
如何声明类型为Employees
的变量employees
?
我尝试了以下操作,但没有成功:
const employees: Employees{};
const employees: {Employees};
const employees: {}Employees;
这很容易。读取文档链接
const employees: Employees = 'your object here'
;