Description
openedon Feb 25, 2023
Hey 👋
I'm trying to figure out what slows our VSCode intellisense (TS-backed code auto-complete) down and may have found the main cause.
Not 100% sure it's RTK Query (createApi
) or not, but figured it's a decent-enough thing I found that I may as well share it.
Where I work at we have a pretty hefty React/RTK app (not OSS 😞), we've been dealing with slow (not unbearable, but annoying) response rate from VSCode intellisense (feels like >1s until the suggestions list shows up, but looking at the TS Server logs it's probably ~800ms).
I tried a few things, eventually landed on this:
If I any-fy the call to createApi
, the TS Server logs report that completionInfo
(which is in charge of computing the list of suggested items that show up in VSCode's autocomplete) drops from 840ms to 122ms.
Here's a video before the change (note how slow it takes from the time I hit .
to when I see the suggestions:
CleanShot.2023-02-25.at.21.15.29.mp4
Here it is when I make the following change:
export const api = createApi({
To:
export const api = (createApi as any)({