unionAll nullable typing error
I have something like this
then I do a
unionAll(blackPlayerOneEloChanges, blackPlayerTwoEloChanges
and get the following error, because blackPlayerTwo is nullable, it's optional, the question is if there is anyway I can override the type of playerid in the blackPlayerTwoEloChanges query, since I'm only selecting the ones where it is not null.
`The types of '.result' are incompatible between these types. Type '{ player_id: string | null; elo_change: number; }[]' is not assignable to type { player_id: string; elo_change: number; }[]'.`Solution:Jump to solution
You could do this:
``ts
const blackPlayerTwoEloChanges = db
.select({
player_id: sql<string>
${matches.blackPlayerTwo}`,...2 Replies
Solution
You could do this:
Lovely, that just works and was surprisingly easy, thank you very much.