piglovesyou/graphql-let

0.18 upgrade issues

marklawlor opened this issue · 5 comments

Hey @piglovesyou, I'm running into a couple of issues upgrading to 0.18

typeInjectEntrypoint

The default for this appears to be wrong. Its an optional value but with the default config it points location that doesn't exist.

Types are being generated in node_modules/.cache/graphql-let/__types__.tsx but its pointing to node_modules/@types/graphql-let/__generated__/__types__

Is this value needed since cacheDir provides the same path info?

Type error: Import declaration conflicts with local declaration

When using the mappers option from typescript-resolvers Typescript cannot compile __types__.tsx. I think this is because 0.18 outputs an .tsx file, while 0.17 outputted a .d.ts file (and used export declare type).

Oh no, I’ll take a look soon. Thank you for taking the time for this!

@marklawlor It seems a lack of document, but not bugs right now. I'd like to know your case in detail, so happy if you try below.

1. typeInjectEntrypoint in .graphql-let.yml

*.tsxes in cacheDir are literally intermediate products to generate final outputs, *.d.ts. Types dependency chains are only valid in *.d.ts, not in *.tsx; it's ok to be broken. How're things change, then? I'd like to know if your code is typed as we expect.

By the way, you usually don't have to change the typeInjectEntrypoint option. It injects types to your gql() and load() by overloading.

2. Types conflict on mappers option from typescript-resolvers

Your output of Resolver Types is also in node_modules/@types/graphql-let/__generated__/__types__.d.ts. You mappers paths should point relatively from the directory. Could you change the paths and try again?

@piglovesyou

  1. Looks like this was an error with some local caching of node_modules. I've fixed that now correctly have the node_modules/@types/graphql-let folder (this was previously missing)

  2. This might be an issue with the documentation missing something

This paths config does not work for us

+     "baseUrl": ".",
+     "paths": {
+       "@graphql-types@": ["graphql-let/__generated__/__types__"]
+     }

However this does

+     "baseUrl": ".",
+     "paths": {
+       "@graphql-types@": ["node_modules/@types/graphql-let/__generated__/__types__"]
+     }

Changing to this path fixed our compiling errors

Thank you for trying it out, @marklawlor. About 2., yes, it should definitely be that explicit path. I modified the page.

Cool, I'll close this now. This update seems to speed up our compile times quite a bit 👍