Closed bmulholland closed 16 hours ago
Thank you for sending bug report!
I could not figure out what code to write to reproduce it. Could you please provide the code to reproduce it?
TIPS: You can easily create reproducible code by forking the playground.
Sure, here you go: https://stackblitz.com/edit/playground-graphql-codegen-typescript-fabbrica-xqluvt?file=src%2Fbookfactory.ts
The key is adding composite: true to the TS config.
Thanks. I was able to reproduce the problem. I will try to resolve this issue.
The editor and Language Server (tsserver) report compile errors, but npx tsc
does not seem to report compile errors. This is very strange...
$ npx tsc
$ echo $?
0
When --noEmit
is true
, it seems that the compile error is not outputted. When --noEmit
is false
, the behavior is as expected.
Environment
@mizdra/graphql-codegen-typescript-fabbrica version: latest typescript version (optional): latest @graphql-codegen/cli version (optional): latest @graphql-codegen/typescript version (optional): latest
Summary
I'm starting adoption of this library (which is awesome -- thank you!!) and am trying to extract my first factory to a file I can import in different places.
When I do, Typescript complains:
The inferred type of 'default' cannot be named without a reference to '~/node_modules/@mizdra/graphql-codegen-typescript-fabbrica/dist/esm/helper/factory'. This is likely not portable. A type annotation is necessary. ts (2742)
If I instead name the import myself, then I get another complaint:
The inferred type of 'XFactory' cannot be named without a reference to '~/node_modules/@mizdra/graphql-codegen-typescript-fabbrica/dist/esm/helper/factory'. This is likely not portable. A type annotation is necessary. ts (2742)
I tried to add a manual type annotation, but that requires quite some contortions, and still seems to cause errors...
ReturnType<DefineTypeFactoryInterface<OptionalX, {}>>
:The types returned by 'build()' are incompatible between these types.
TypeFactoryInterface<Type, TransientFields, _DefaultFieldsResolver, _Traits>;
, including defining_DefaultFieldsResolver
somehow etc.Is there something I'm missing? Is there a recommended way to deal with the typing here?
Step to reproduce
above
What did you expect to happen?
above
What actually happened?
above
Participation
Additional comments
No response