@@ -740,7 +740,15 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
740740 Definitions
741741 >
742742 const dispatch = useDispatch < ThunkDispatch < any , any , UnknownAction > > ( )
743- const subscriptionSelectorsRef = useRef < SubscriptionSelectors > ( )
743+
744+ // TODO: Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.
745+ /**
746+ * @todo Change this to `useRef<SubscriptionSelectors>(undefined)` after upgrading to React 19.
747+ */
748+ const subscriptionSelectorsRef = useRef <
749+ SubscriptionSelectors | undefined
750+ > ( undefined )
751+
744752 if ( ! subscriptionSelectorsRef . current ) {
745753 const returnedValue = dispatch (
746754 api . internalActions . internal_getRTKQSubscriptions ( ) ,
@@ -781,7 +789,13 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
781789
782790 const lastRenderHadSubscription = useRef ( false )
783791
784- const promiseRef = useRef < QueryActionCreatorResult < any > > ( )
792+ // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.
793+ /**
794+ * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.
795+ */
796+ const promiseRef = useRef < QueryActionCreatorResult < any > | undefined > (
797+ undefined ,
798+ )
785799
786800 let { queryCacheKey, requestId } = promiseRef . current || { }
787801
@@ -886,7 +900,14 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
886900 const dispatch = useDispatch < ThunkDispatch < any , any , UnknownAction > > ( )
887901
888902 const [ arg , setArg ] = useState < any > ( UNINITIALIZED_VALUE )
889- const promiseRef = useRef < QueryActionCreatorResult < any > | undefined > ( )
903+
904+ // TODO: Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.
905+ /**
906+ * @todo Change this to `useRef<QueryActionCreatorResult<any>>(undefined)` after upgrading to React 19.
907+ */
908+ const promiseRef = useRef < QueryActionCreatorResult < any > | undefined > (
909+ undefined ,
910+ )
890911
891912 const stableSubscriptionOptions = useShallowStableValue ( {
892913 refetchOnReconnect,
@@ -966,7 +987,7 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
966987
967988 type ApiRootState = Parameters < ReturnType < typeof select > > [ 0 ]
968989
969- const lastValue = useRef < any > ( )
990+ const lastValue = useRef < any > ( undefined )
970991
971992 const selectDefaultResult : Selector < ApiRootState , any , [ any ] > = useMemo (
972993 ( ) =>
0 commit comments