Typescript bug or am I stupid?
How can pi_latest_charge within the findIndex function be possibly Null? While two lines above, the assignment to x is valid and not possibly null.
ps: already restarted lint and typescript server.

if (pi.latest_charge == null) {
throw new Error('latest_charge is null or string. should have been expanded');
}
const x = pi.latest_charge.id;
const hasDispute = disputes.findIndex((d) => {
return d.charge == pi.latest_charge.id && d.status == 'lost';
}) != -1;