sindresorhus/eslint-plugin-unicorn
[consistent-destructuring] incorrect fix for ts `in` type guard
Fermée
#1 112 ouverte le 18 févr. 2021
bughelp wanted
Métriques du dépôt
- Stars
- (5 022 étoiles)
- Métriques de merge PR
- (Merge moyen 4h 30m) (26 PRs mergées en 30 j)
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