sindresorhus/eslint-plugin-unicorn
Auf GitHub ansehen[consistent-destructuring] incorrect fix for ts `in` type guard
Open
#1.112 geöffnet am 18. Feb. 2021
bughelp wanted
Beschreibung
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