sindresorhus/eslint-plugin-unicorn
[consistent-destructuring] incorrect fix for ts `in` type guard
Closed
#1,112 opened on Feb 18, 2021
bughelp wanted
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
const { a }: { a: string } & ({ b: number } | { c: number } | {}) = params
const value = 'b' in params ? params.b : 'c' in params ? params.c : null
// incorrect fixed
const { a, b, c }: { a: string } & ({ b: number } | { c: number } | {}) = params
const value = 'b' in params ? b : 'c' in params ? c : null
The fixed codes is not runnable anymore. Playground