xmldoc
npm パッケージの型定義を書こうとしています。
これまでのところ、私はこれを持っています:
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 はまだこのコードで不平を言っています
valueId = node.attr["id"];
エラーメッセージ付きobject access via string literals is disallowed
私のインデクサー([index: string]: string
)はこれを回避したと思いました。
なぜそれが機能しないのか、誰かが私に手がかりを与えることができますか?