Closed dnlsandiego closed 1 month ago
That's odd, somehow TypeScript is refusing to evaluate the symbol in the pokemon-item.tsx
file. It finds the type however when we check the symbol
the intrinsicName
is never
and no symbol is assigned, while in the editor it works perfectly fine.
It is odd that the document that the cache produces for you initially is also empty 😅 A bit confused atm as even when I mold this more into our example of examples/example-pokemon-api
, which produces correctly for both the query and the fragment, it still doesn't work. Trying to see whether it's some config issue with gql.tada doctor
also gave nothing.
One interesting thing is that without the cache the query document node looks like
const PokemonsQuery: TadaDocumentNode<{
pokemons: ({
[$tada.fragmentRefs]: {
PokemonItem: "Pokemon";
};
id: string;
} | null)[] | null;
}, {
limit?: number | null | undefined;
}, void>
With the cache
const PokemonsQuery: TadaDocumentNode<{}, {
limit?: number | null | undefined;
}, {
fragment: "Pokemons";
on: unknown;
masked: true;
}>
We had a similar issue before this related to a moduleResolution
issue, so we'll likely have to go through tsconfig.json
settings and see whether one of them affects the run 🤔
Just a heads up, I haven't forgotten about this, but the behaviour is really odd. The result of gql.tada
's graphql
calls seems to infer to never
unless I symlink my local build of gql.tada
into the reproduction. However, my local build is identical to the currently published version, so there seems to be something weird going on with some dependencies.
Edit: This might be related to a bug in either our code or @typescript/vfs
' code related to pnpm. When I reinstall all dependencies with Yarn the issues also disappears, so it feels like a resolution bug.
@dnlsandiego: This proved to be hard to reproduce, but it was easy to track down in the end. I'm not sure how we didn't catch this in other reproductions/examples, but it basically came down to a missing realpath
resolution, which is required with pnpm
Describe the bug
It looks like the
turbo
command isn't including fragments in the generated cache file. Which results in an incompletegraphql-cache.d.ts
, breaking types in the editor.I've created a small repo in the reproduction link. But it's basically the
example-pokemon-api
in the examples folder. Given:Running
gql.tada turbo
results in a graphql-cache.d.ts that hasPokemonItem
is being spread here but it's not included anywhere. Compared to when the fragment is in the same document:A warning is also shown
Reproduction
https://github.com/dnlsandiego/gql.tada-cache-issue
gql.tada version
gql.tada
1.7.0
@0no-co/graphqlsp
^1.12.2
Validations