question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exported schemas in .ts files are not generated

See original GitHub issue

Hi, trying to migrate from 0.2.0 to 1.1.2 but it doesn’t seem my type for an exported query schema gets exported anymore (file is in src/lib/ folder). Under 0.2.0 the following query:

export const schema = graphql`
  query Posts {
    allMdx(sort: { order: DESC, fields: [frontmatter___date] }) {
      edges {
        node {
          id
          excerpt(pruneLength: 250)
          frontmatter {
            title
            slug
            categories
            tags
          }
          body
        }
      }
    }
  }
`

would result in the following schema generation

export type PostsQuery = (
  { __typename?: 'Query' }
  & { allMdx: (
    { __typename?: 'MdxConnection' }
    & { edges: Array<(
      { __typename?: 'MdxEdge' }
      & { node: (
        { __typename?: 'Mdx' }
        & Pick<Mdx, 'id' | 'excerpt' | 'body'>
        & { frontmatter: Maybe<(
          { __typename?: 'MdxFrontmatter' }
          & Pick<MdxFrontmatter, 'title' | 'slug' | 'categories' | 'tags'>
        )> }
      ) }
    )> }
  ) }
);

What I am doing wrong here, are there breaking changes?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
hasparuscommented, Oct 22, 2020

Hey folks, I just wanted to mention that I resolved my " Cannot find namespace ‘GatsbyTypes’." problem by adding

import "./src/__generated__/gatsby-types";

to my gatsby-config.ts.

I hope it helps somebody who lands here googling this error like I did today 😊

1reaction
ecklfcommented, May 4, 2020

I’ll create a repo that reproduces the issue tomorrow 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

codegen.ts file - GraphQL Code Generator
GraphQL Code Generator relies on a configuration file named codegen.ts to manage all possible options, input, and output document types.
Read more >
typescript-json-schema - npm
Generate json-schemas from your Typescript sources. Features. Compiles your Typescript program to get complete type information. Translates ...
Read more >
TypeScript Type Safety with AJV Standalone
It can not know that the JSON object being casted to Type A actually ... Generate the JSON Schema files from the TS...
Read more >
Generating the client (Concepts) - Prisma
prisma/client folder, which is the default location for the unique Prisma Client generated from your schema. @prisma/client/index.d.ts exports .prisma/client :.
Read more >
db2move - Database movement tool command - IBM
The default for the EXPORT action is all schemas. The default does not apply to the COPY action. If you specify multiple schema...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found