You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mizdra/graphql-codegen-typescript-fabbrica version: 0.3.2
typescript version (optional):
@graphql-codegen/cli version (optional):
@graphql-codegen/typescript version (optional):
Summary
I would expect a type error to be reported when an unknown field is passed to defaultFields, but it is not.
typeBook {
title: String!
}
import{defineBookFactory}from'../__generated__/fabbrica';constBookFactory=defineBookFactory({defaultFields: {title: 'Yuyushiki',// @ts-expect-error I expect a type error to be reported, but it is not.unknownField: 'hello',},});
Environment
@mizdra/graphql-codegen-typescript-fabbrica version: 0.3.2
typescript version (optional):
@graphql-codegen/cli version (optional):
@graphql-codegen/typescript version (optional):
Summary
I would expect a type error to be reported when an unknown field is passed to
defaultFields
, but it is not.Step to reproduce
https://stackblitz.com/edit/playground-graphql-codegen-typescript-fabbrica-4yjhkc?file=src%2Findex.test.ts&view=editor
What did you expect to happen?
A type error is reported.
What actually happened?
No type errors are reported.
Participation
Additional comments
It may be necessary to assign a dedicated type parameter for each field.
https://www.typescriptlang.org/play?#code/C4TwDgpgBA8mwEsD2A7AhgGwEJKQaygF4oBvAKCikWAwgH4AuKAZ2ACcEUBzKAHygCuKACYQAZpwjCA3BSgJhjFu049+Q0RJRTZAX1llRAYwxo20MUKOJUUAEYCEGYTnwBGADwAVKBAAewBAizLDwyOjYuHgAfAAUZlzMTF4AlMmyRqisUObMAhjAbkT2js6ueG6x5AD01ZSUAHp0ctS0TADkaO0ANHK1UAACwMwAtP6Q1mNsbEhsckJ4KEgA7igAYggQzkxuvbopsrG5+YUsaIjMEhAhJFQINBBMrBzcUPsGxqbmUJYo1uElJwuKIAJm8vgCQWEITgNgi5QA2u1WhB2gBdYoacSSYTdKAAVQhgWCoThmER7QU6MxImx2mEcQSSVIdweSi8eIUSkJ+yYtxRyU5wiYPIyWWAOWuJxBxQcQPKIKqZH69SaLXubSgnR6fTqQ1G4wgkwg01m8xQixW6022yguzI7zIRylBRlzHOCEumxurM1z1UbwOZEMRq+FiscMBZSiAGZwf5idDSeFyVFGWxEnzfY8oF4kSj0ULkkiqRjebmxShsscCjHZaVgfgY0qVY1mpQBVqur1KP19WM-BNgFMZnNKAslqsNlthXa9kHnXla2cLlcfZ3-a9HUA
The text was updated successfully, but these errors were encountered: