query icon indicating copy to clipboard operation
query copied to clipboard

Enabled exactOptionalPropertyTypes causes error when trying to use the optional selector

Open vladcos opened this issue 1 year ago • 0 comments

Describe the bug

Per article https://tkdodo.eu/blog/react-query-data-transformations#3-using-the-select-option I'm using the optional select() passed from outside. When typing it as described by @TkDodo here https://stackoverflow.com/a/75788655/255408 an error comes up (see repro)

Your minimal, reproducible example

https://www.typescriptlang.org/play/?exactOptionalPropertyTypes=true#code/JYWwDg9gTgLgBAbwFBzgVwM4FMCKatQCeANEgL5wBmUEIcA5AAIwCGAdhqwMYDWA9FCwsuMALQBHfEXpIkMQmCxwAogA8CXYNgxwAvIjKysqyLDhcIHeJiwBxLDDUatWDAHkA0nrgAeACoAIiys3k5QmtoAfAAU2AA2WCIA-ABccNEAJsEsaWERrgCUepFwgdlFuiXIqIIwaFBs6Nh4BITR1ahwkq0eWIRpANr0xs7a9AC6pJ1dUoQAYmxp0RUlA5MonQB027FYCSJwSYhw8YnwFGkIZAVTcNcA3OSPRibQ8BZWTXYOeS4YygAlAFuAHefxBEL6X5RXb7GCpdJZVi5dThP4rUoQlgYjq1eqNGwtIjtDaobpEXr9OBDEZosbrabk+aLdIYta3VCnES3B5PIA

Steps to reproduce

The combinations of the typings and enabled exactOptionalPropertyTypes cause an error because an explicit undefined is not allowed

Expected behavior

The typings should allow explicit undefined

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Any

Tanstack Query adapter

react-query

TanStack Query version

v5.36.1

TypeScript version

v5.5.2

Additional context

No response

vladcos avatar Jun 28 '24 13:06 vladcos