Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeScript config in vanilla-typescript guide #10175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eddeee888
Copy link
Collaborator

@eddeee888 eddeee888 commented Oct 19, 2024

Description

In the current Vanilla TypeScript guide, the provided tsconfig.json won't work with the generated TypedDocumentString. This is because it requires at least ES6 features and the default TS config target is ES5.

Without this change, users may see this error:

private value: string,
             ^
TypeError: Cannot create property 'value' on string '
  <document template>
'
at new TypedDocumentString (/path/to/graphql-server/src/graphql/graphql.ts:169:18)

This PR adds target: 'ES6', which is the minimum requirement, to the tsconfig.json example

Result

Screenshot 2024-10-19 at 12 59 18 PM

Copy link

changeset-bot bot commented Oct 19, 2024

⚠️ No Changeset found

Latest commit: aa2cc92

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/visitor-plugin-common 5.5.0-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-document-nodes 4.0.11-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 4.0.11-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 4.3.1-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 4.4.0-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/typed-document-node 5.0.11-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript 4.1.1-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 4.5.0-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 4.0.11-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎
@graphql-codegen/plugin-helpers 5.1.0-alpha-20241019015509-aa2cc9241fbcec1a4683c64896bcbf0bbcd029dc npm ↗︎ unpkg ↗︎

Copy link
Contributor

💻 Website Preview

The latest changes are available as preview in: https://3e1374ec.graphql-code-generator.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant