I've got this short snippet
const value = current
.filter((x) => x.key === key);
return value;
The current variable is Target[] | Bonus[]. But value is being typed as just Bonus[]. Both Bonus and Target are declared classes in my .d.ts file, and they both have a key property. I'm not sure why this is losing the either/or type here.
(p.s. this is javascript using jsdoc comments for typing, hence why there's a specific .d.ts file)