I have a Employees typescript interface:
export interface Employees {
[employeeId: string]: {
name: string
gender: Gender
}
}
How would I declare a variable employees
that is of type Employees
?
I have tried the following without success:
const employees: Employees{};
const employees: {Employees};
const employees: {}Employees;
It's easy. Read docs link
const employees: Employees = 'your object here'
;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.