Describe the bug
I'm getting errors on the generated file. Comparing mine to other ones, it sure looks very strange. I could go on and fix the problem manually in the file, but it'd be lost after re-generating.
Error message
Type '"[object Object]"' does not satisfy the constraint '"__typename" | "id" | "name" | "size" | "filename" | "caminho" | "type" | "idObj" | "usuarios_id"'. TS2344
1004 | & { anexos?: Maybe<Array<Maybe<(
1005 | { __typename?: 'anexos' }
> 1006 | & Pick<Anexos, '[object Object]' | '[object Object]' | '[object Object]' | '[object Object]'>
| ^
1007 | )>>> }
1008 | );
1009 |
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE
type anexos {
id: ID!
name: String!
size: Float!
filename: String!
caminho: String!
type: String!
idObj: ID
usuarios_id: sistema_usuarios!
}
...
type Query {
anexos(idObj: ID): [anexos]
anexo(id: ID!): anexos
...
}
...
query Anexos($idObj: ID) {
anexos(idObj: $idObj) {
id
name
size
type
}
}
export type Anexos = {
__typename?: 'anexos';
id: Scalars['ID'];
name: Scalars['String'];
size: Scalars['Float'];
filename: Scalars['String'];
caminho: Scalars['String'];
type: Scalars['String'];
idObj?: Maybe<Scalars['ID']>;
usuarios_id: Sistema_Usuarios;
};
...
export type AnexosQuery = (
{ __typename?: 'Query' }
& { anexos?: Maybe<Array<Maybe<(
{ __typename?: 'anexos' }
& Pick<Anexos, '[object Object]' | '[object Object]' | '[object Object]' | '[object Object]'>
)>>> }
);
codegen.yml config file:overwrite: true
schema: "http://localhost:3938/graphql"
documents: "src/services/gql/api/*.gql"
generates:
src/services/gql/generated/index.tsx:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo"
config:
whithHOC: false
withComponents: false
withHooks: true
Environment:
Additional context
Query works fine on Playground. The error happens in other queries too, but I can't show them here. The error started after adding this query, it was working fine before, but removing the query doesn't fix the problem.
Thanks for the quick reply. Updating solved the problem.
Most helpful comment
Thanks for the quick reply. Updating solved the problem.