I am trying to write type definitions for the xmldoc
npm package.
So far I have this:
declare module 'xmldoc' {
export class XmlDocument {
constructor(contents: string);
public children: IXmlNode[];
}
export interface IXmlNode {
attr: IXmlAttributes;
val: string;
name: string;
children: IXmlNode[];
}
export interface IXmlAttributes {
[index: string]: string;
}
}
tslint is still complaining at this code
valueId = node.attr["id"];
with the error message object access via string literals is disallowed
I thought my indexer ([index: string]: string
) worked around this.
Can anyone give me a clue as to why it isn't working?