sindresorhus/eslint-plugin-unicorn
在 GitHub 查看[consistent-destructuring] incorrect fix for ts `in` type guard
Open
#1,112 创建于 2021年2月18日
bughelp wanted
描述
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