-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueRevisitAn issue worth coming back toAn issue worth coming back to
Milestone
Description
The DOMStringMap interface is defined as follows:
https://github.com/Microsoft/TypeScript/blob/master/src/lib/dom.generated.d.ts#L10556
interface DOMStringMap {
}
declare var DOMStringMap: {
prototype: DOMStringMap;
new(): DOMStringMap;
}This means it's a compile error to directly access the object properties, but it's also an implicit any error if the --noImplicitAny switch is turned on in the compiler. This makes using a node's dataset somewhat arduous since a cast is required.
I'm not sure if there is some way to declare that an object has arbitrary properties of some given type, but perhaps a minimal working solution would be to give this interface a string indexer:
interface DOMStringMap {
[key: string]: string;
}Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueRevisitAn issue worth coming back toAn issue worth coming back to