Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with TypeScript 5.6 #271

Open
tmcw opened this issue Sep 16, 2024 · 0 comments · May be fixed by #272
Open

Incompatible with TypeScript 5.6 #271

tmcw opened this issue Sep 16, 2024 · 0 comments · May be fixed by #272

Comments

@tmcw
Copy link

tmcw commented Sep 16, 2024

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:

return !utils.access(data, check) ?? true;

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.

@tmcw tmcw linked a pull request Sep 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant