With the following line of code …
const [broadcastSubscription, setBroadcastSubscription] = useState(null);
… if I only need to use the setter, then the unused broadcastSubscription variable triggers an “… is declared but its value is never read” error (typescript:S1854).
However, I can’t figure out how to correct this without creating new errors, because the “useState call is not destructured into a value + setter pair” error (typescript:S6754) is only satisfied if both variables share the same naming convention – prefixing with a _ (which turns off ESLint’s “variable not used” warning) isn’t allowed, nor is leaving the variable out entirely (e.g. [, setBroadcastSubscription] = …).
It’s as if these two rules are completely at odds with each other: One requires I define a variable I won’t be using, while the other complains if I don’t use my variables.
Is there any way around this, short of disabling these otherwise helpful rules?
Thank you kindly in advance for your help!