Microsoft/TypeScript

No report of implicit any type in a generator when destructuring

Open

#43,172 opened on Mar 10, 2021

View on GitHub
ย (5 comments)ย (0 reactions)ย (0 assignees)TypeScriptย (48,455 stars)ย (6,726 forks)batch import
BugDomain: check: Type InferenceHelp Wanted

Description

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

Contributor guide

No report of implicit any type in a generator when destructuring ยท Microsoft/TypeScript#43172 | Good First Issue