When the TypeScript compiler option exactOptionalPropertyTypes
is enabled, RTK Query hook results don’t narrow data
(and similarly error
) after status flag checks. For example, inside an if (result.isSuccess)
block, result.data
still has the type T | undefined
instead of narrowing to T
. With the flag disabled, narrowing behaves as expected.
Reproduction
https://github.com/chirophobic/rtkquery-exact-optional-property-types-