I have the following code in TypeScript:
export class Config
{
private options = new Map<string, string>();
constructor() {
}
public getOption(name: string): string {
return this.options[name];
}
}
And the compiler gives me this error:
Error:(10, 16) TS7017: Index signature of object type implicitly has an 'any' type.
The card is "possible" through es6-shim. I'm not quite sure what is going on here. In fact, this card confuses me a bit. It is assumed that the card should come from es6-shim, which should implement es6 functionality. But es6 has no static types, right? So why does Map expect key / value types to be used as general arguments? I saw some people add the "noImplicitAny" flag, but I want to solve the problem, not ignore it.
Thanks.
source
share