Description
I'd like to propose/discuss the possibility of officially supporting or recommending a TypeScript Language Service Plugin that enhances the IDE experience for RTK Query users.
The Problem
When using RTK Query, developers frequently face a navigation issue:
const api = createApi({
endpoints: (builder) => ({
getUser: builder.query({ ... }) // Endpoint definition here
})
})
// When using "Go to Definition" (F12/Cmd+Click) on useGetUserQuery:
const { data } = useGetUserQuery() // Jumps to type definitions, not the endpoint above
Because hook names (useGetUserQuery) are dynamically derived from endpoint names (getUser), TypeScript's "Go to Definition" can only point to the complex type gymnastics in @reduxjs/toolkit/query, rather than the actual endpoint definition in createApi.
This creates friction in the development workflow, especially in larger codebases where developers need to quickly navigate between hook usage and endpoint implementation.
Proposed Solution
I've developed a TypeScript Language Service Plugin called rtk-to-endpoints that solves this problem by:
- Intercepting the "Go to Definition" request
- Recognizing RTK Query hook naming patterns (
use{Endpoint}Query, use{Endpoint}Mutation, etc.)
- Navigating directly to the corresponding endpoint definition
Supported patterns:
use{Endpoint}Query
useLazy{Endpoint}Query
use{Endpoint}Mutation
use{Endpoint}QueryState
use{Endpoint}InfiniteQuery
use{Endpoint}InfiniteQueryState
Request for Redux Toolkit Team
I would like to discuss the possibility of:
- Official endorsement: Adding this plugin (or a similar solution) to the official RTK Query documentation as a recommended development tool
- Future integration: Consider integrating similar functionality directly into RTK Query or as an official
@reduxjs/toolkit package
- Feedback: Getting feedback on the implementation approach and any potential improvements
Additional Context
The plugin is currently working well for my use cases, but I believe it would benefit the broader RTK Query community if it had some form of official recognition or integration.
Description
I'd like to propose/discuss the possibility of officially supporting or recommending a TypeScript Language Service Plugin that enhances the IDE experience for RTK Query users.
The Problem
When using RTK Query, developers frequently face a navigation issue:
Because hook names (
useGetUserQuery) are dynamically derived from endpoint names (getUser), TypeScript's "Go to Definition" can only point to the complex type gymnastics in@reduxjs/toolkit/query, rather than the actual endpoint definition increateApi.This creates friction in the development workflow, especially in larger codebases where developers need to quickly navigate between hook usage and endpoint implementation.
Proposed Solution
I've developed a TypeScript Language Service Plugin called
rtk-to-endpointsthat solves this problem by:use{Endpoint}Query,use{Endpoint}Mutation, etc.)Supported patterns:
use{Endpoint}QueryuseLazy{Endpoint}Queryuse{Endpoint}Mutationuse{Endpoint}QueryStateuse{Endpoint}InfiniteQueryuse{Endpoint}InfiniteQueryStateRequest for Redux Toolkit Team
I would like to discuss the possibility of:
@reduxjs/toolkitpackageAdditional Context
rtk-to-endpointsThe plugin is currently working well for my use cases, but I believe it would benefit the broader RTK Query community if it had some form of official recognition or integration.