Skip to content

Diagnostic message contains a stray "[object Object]" #39524

@whatisaphone

Description

@whatisaphone

TypeScript Version: v4.0.0-dev.20200708

Search Terms: implicitly index signature map get

Code

interface Foo {
    bar: Map<string, string>;
}

declare const foo: Foo;

const nom = foo.bar['nom']; // error on this line

Expected behavior:

The error should say:

Element implicitly has an 'any' type because type 'Map<string, string>' has no index signature. Did you mean to call 'foo.bar.get'?

Actual behavior:

The error says:

Element implicitly has an 'any' type because type 'Map<string, string>' has no index signature. Did you mean to call 'foo.[object Object].get'?

Playground Link:

Playground Link

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions