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

The type ArticlesQuery does not exist in types/graphql #6078

Closed
1 task
adriatic opened this issue Jul 29, 2022 · 5 comments
Closed
1 task

The type ArticlesQuery does not exist in types/graphql #6078

adriatic opened this issue Jul 29, 2022 · 5 comments
Assignees
Labels
bug/needs-info More information is needed for reproduction topic/typescript

Comments

@adriatic
Copy link
Contributor

adriatic commented Jul 29, 2022

What's not working?

The tutorial section Getting Dynamic defines the code for the file web/src/components/ArticlesCell/ArticlesCell.tsx. TS version as:

import type { ArticlesQuery } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'

export const QUERY = gql`
  query ArticlesQuery {
    posts {
      id
    }
  }
`

However the ArticlesQuery type does not exist in types/graphql as shown below:

image

Note that the file types/graphql.d.ts does not compile and this is the real problem IMHO

How do we reproduce the bug?

Reproducing the problem requires typing the whole tutorial (the TypeScript) version up to (including) section https://redwoodjs.com/docs/tutorial/chapter2/cells#our-first-cell as this version does not exist anywhere (to the best of my knowledge).

A better alternative is to verify that graphql.d.ts does not export type ArticlesQuery.

Vscode claims that there are two additional problems in the graphql.d.ts file, as shown below

image

Problem 1
image

Problem 2
image

What's your environment? (If it applies)

nik$ yarn rw info

  System:
    OS: macOS 12.4
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.1 - /private/var/folders/y3/n2p741pj7vq9ckj9jrmlbp6m0000gn/T/xfs-ed49c479/node
    Yarn: 3.2.1 - /private/var/folders/y3/n2p741pj7vq9ckj9jrmlbp6m0000gn/T/xfs-ed49c479/yarn
  Databases:
    SQLite: 3.37.0 - /usr/bin/sqlite3
  Browsers:
    Chrome: 103.0.5060.134
    Firefox: 102.0.1
    Safari: 15.5
  npmPackages:
    @redwoodjs/core: 2.2.0 => 2.2.0

Are you interested in working on this?

  • I'm interested in working on this
@adriatic adriatic added the bug/needs-info More information is needed for reproduction label Jul 29, 2022
@redwoodjs-bot redwoodjs-bot bot moved this to Triage in Main Jul 29, 2022
@redwoodjs-bot redwoodjs-bot bot added this to Main Jul 29, 2022
@noire-munich
Copy link
Collaborator

Thanks @adriatic , we are aware of issues in typescript tutorial so any reporting is useful to us 👍🏻 .

@jtoar I'm not sure how to reassign this, so I'll pass it up to you.

@noire-munich noire-munich assigned jtoar and unassigned noire-munich Jul 29, 2022
@adriatic
Copy link
Contributor Author

@noire-munich is there some workaround / temporary re-declarations to get me going? It is hard to believe that typescript development is dead at this moment?

@adriatic
Copy link
Contributor Author

adriatic commented Aug 1, 2022

Since my original write up I found a lot easier proof of this bug.

type yarn create redwood-app --ts ./redwood-stripe to the terminal and use VSCode to view the just generated application. Observe that the generated file graphql.d.ts lacks the definition of the prisma namespace.

This of course has consequences for each and every Redwood TypeScript application

@arreagaelio1
Copy link

I experienced the same thing and in chapter 7 when adding roles: true in the getCurrentUser function I get a type error
Screenshot_3

@dac09
Copy link
Contributor

dac09 commented Aug 3, 2022

  1. type ArticlesQuery does not exist

You just have have to run yarn rw g types or have your dev server running. See more info on generating types here: https://redwoodjs.com/docs/typescript#auto-generated-types

This is mentioned in the tutorial a few lines above.
Screenshot 2022-08-03 at 13 50 00

Any thoughts on how we could make this more obvious for you within the tutorial?

  1. Prisma underlined in generated types/graphql.d.ts

This of course has consequences for each and every Redwood TypeScript application

I don't believe the Prisma error actually has any consequences on Redwood applications, it's a bug in the generated types but actually doesn't break anything within your application. This is being tracked in #6096, and will close this issue as duplicate.

@dac09 dac09 closed this as completed Aug 3, 2022
Repository owner moved this from Triage to Done in Main Aug 3, 2022
@dac09 dac09 changed the title [Bug?]: The type ArticlesQuery does not exist in types/grapql [Bug?]: The type ArticlesQuery does not exist in types/graphql Aug 3, 2022
@dac09 dac09 changed the title [Bug?]: The type ArticlesQuery does not exist in types/graphql The type ArticlesQuery does not exist in types/graphql Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction topic/typescript
Projects
Status: Done
Development

No branches or pull requests

5 participants