Skip to content

No report of implicit any type in a generator when destructuring Β #43172

Open
@Igorbek

Description

@Igorbek

Bug Report

πŸ”Ž Search Terms

no implicit any, generator, yield, destructure
#41348 - Report implicit any error for 'yield' result with no contextual type

πŸ•— Version & Regression Information

TypeScript 4.2.3

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

function* sample() {
    const a = yield 1 // error, as expected, a is implicitly any
    const { b } = yield 1 // no error, but expected, b is implicitly any
    const [c] = yield 1 // no error, but expected, c is implicitly any
}

πŸ™ Actual behavior

b, c implicitly have type any, but no error reported

πŸ™‚ Expected behavior

Errors reported

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions