We're just upgrading to TypeScript 5.6 in our project, and came across a problem in the types in react-arborist:
node_modules/react-arborist/src/interfaces/tree-api.ts:596:12 - error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
596 return !utils.access(data, check) ?? true;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/react-arborist/src/interfaces/tree-api.ts:601:12 - error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
601 return !utils.access(data, check) ?? true;
This seems to make sense - TypeScript is right that this line:
Will never execute the branch on the right, because ! will cast the result of the utils.access call to a boolean, so it'll never be nullish, so it'll never fall back to true.
We're just upgrading to TypeScript 5.6 in our project, and came across a problem in the types in react-arborist:
This seems to make sense - TypeScript is right that this line:
https://github.com/brimdata/react-arborist/blob/3cee71c318c8cb1c3c490ffa977c1b6d2f0264d2/modules/react-arborist/src/interfaces/tree-api.ts#L596
Will never execute the branch on the right, because
!
will cast the result of theutils.access
call to a boolean, so it'll never be nullish, so it'll never fall back totrue
.