-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Bug Report
π Search Terms
catch, destructure, destructuring, useUnknownInCatchVariables
π Version & Regression Information
- This is the behavior in every version I tried: v4.0.5, v4.5.4
β― Playground Link
Playground link with relevant code
π» Code
let a: unknown;
let {foo} = a;
// ^^^ Property 'foo' does not exist on type 'unknown'.(2339)
function bar({foo}: unknown) {}
// ^^^ Property 'foo' does not exist on type 'unknown'.(2339)
try {
} catch ({foo}: unknown) {
// foo is type any
// with useUnknownInCatchVariables foo is type unknown
}
π Actual behavior
Destructuring unknown
is an error, but destructuring a catch variable, which is of type unknown
is not an error.
π Expected behavior
I would expect destructuring of a catch variable of type unknown
to produce an error.
MartinJohns, lvelden, IllusionMH, tonivj5, omril1 and 1 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone