dotansimha / dotansimha/graphql-typed-document-node

Graphql parse error

Open
#142 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
412
Forks
22
PR merge metrics
No merged PRs in 30d

Description

```
overwrite: true
schema: "http://localhost:4000"
documents: "src/**/*.gql"
generates:
src/graphql/_generated/graphql.ts:
plugins:
- typescript
- typescript-operations
- typed-document-node
config:
# skipTypeNameForRoot: true
skipTypename: true
maybeValue: T | undefined
```
here is generated code:

```
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type Maybe = T | undefined;
export type InputMaybe = T | undefined;
export type Exact = { [K in keyof T]: T[K] };
export type MakeOptional = Omit & { [SubKey in K]?: Maybe };
export type MakeMaybe = Omit & { [SubKey in K]: Maybe };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
};

export type Mutation = {
signup?: Maybe;
};

export type MutationSignupArgs = {
email: Scalars['String'];
firstName: Scalars['String'];
lastName: Scalars['String'];
password: Scalars['String'];
referralCode?: InputMaybe;
};

export type Query = {
ok: Scalars['Boolean'];
};

export type SignupMutationVariables = Exact<{
firstName: Scalars['String'];
lastName: Scalars['String'];
email: Scalars['String'];
password: Scalars['String'];
referralCode?: InputMaybe;
}>;

export type SignupMutation = { signup?: string | undefined };

export type QueryQueryVariables = Exact<{ [key: string]: never; }>;

export type QueryQuery = { ok: boolean };

export const SignupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Signup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"firstName"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"lastName"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"email"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"referralCode"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"firstName"},"value":{"kind":"Variable","name":{"kind":"Name","value":"firstName"}}},{"kind":"Argument","name":{"kind":"Name","value":"lastName"},"value":{"kind":"Variable","name":{"kind":"Name","value":"lastName"}}},{"kind":"Argument","name":{"kind":"Name","value":"email"},"value":{"kind":"Variable","name":{"kind":"Name","value":"email"}}},{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}},{"kind":"Argument","name":{"kind":"Name","value":"referralCode"},"value":{"kind":"Variable","name":{"kind":"Name","value":"referralCode"}}}]}]}}]} as unknown as DocumentNode;
export const QueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Query"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ok"}}]}}]} as unknown as DocumentNode;
```

this is my SDL:

```type Query {
ok: Boolean!
}

type Mutation {
signup(referralCode: String, firstName: String!, lastName: String!, email: String!, password: String!): String
}
```

A few days ago, everything was working fine until I switched to NexsusJS framework for my backend.

I tried apollo client, I tried `urql`, but both have a problem parsing node type document.

this is `TypeError: graphql.print is not a function` urql for example

any ideas what I'm doing wrong?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.