Closed
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;
}