Skip to content

Feature Request / Discussion: Official TypeScript Language Service Plugin for Enhanced IDE Navigation #5244

@flycran

Description

@flycran

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:

  1. Intercepting the "Go to Definition" request
  2. Recognizing RTK Query hook naming patterns (use{Endpoint}Query, use{Endpoint}Mutation, etc.)
  3. 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:

  1. Official endorsement: Adding this plugin (or a similar solution) to the official RTK Query documentation as a recommended development tool
  2. Future integration: Consider integrating similar functionality directly into RTK Query or as an official @reduxjs/toolkit package
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RTK-QueryIssues related to Redux-Toolkit-QueryTypeScriptIssues related to TypeScript.
    No fields configured for Enhancement.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions