Skip to content

Type inference when destructuring a lambda parameter doesn't work #4949

Description

@joaomoreno

Paste this snippet in the playground:

const result = [{ foo: 'hello' }]
    .map(({ foo }) => foo)
    .map(foo => foo);

If you hover over foo in the first map() call, you'll notice that its type is any (should be string).

The type of result is correctly inferred to be string[], though. It just seems that there is no type information for destructured function parameters.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions