-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Typescript requires that enums have number value types (hopefully soon, this will also include string value types).
Attempting to use an enum as a key type for a hash results in this error: "Index signature parameter type much be 'string' or 'number' ".-- An enum is actually a number type.-- This shouldn't be an error.
Enums are a convenient way of defining the domain of number and string value types, in cases such as
export interface UserInterfaceColors {
[index: UserInterfaceElement]: ColorInfo;
}
export interface ColorInfo {
r: number;
g: number;
b: number;
a: number;
}
export enum UserInterfaceElement {
ActiveTitleBar = 0,
InactiveTitleBar = 1,
}
gregb, michalstocki, mateuszkocz, resal81, dardino and 295 moreRonNewcomb, semlette, joaomcarlos, riglar, apollocoder and 33 more
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript