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

chore(gatsby): convert schema-customization to typescript #24259

Merged

Conversation

Kornil
Copy link
Contributor

@Kornil Kornil commented May 20, 2020

Convert schema-customization reducer to TypeScript.

Related Issues

#21995

@Kornil Kornil requested a review from a team as a code owner May 20, 2020 12:14
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 20, 2020
Copy link
Contributor

@vladar vladar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help! But looks like it fails a typecheck now:

packages/gatsby/src/commands/develop-process.ts:202:15 - error TS2322: Type 'IGatsbyState' is not assignable to type '{ schema: GraphQLSchema; schemaCustomization: { composer: SchemaComposer<any>; context: any; }; }'.
  The types of 'schemaCustomization.composer' are incompatible between these types.
    Type 'SchemaComposer<any> | null' is not assignable to type 'SchemaComposer<any>'.
      Type 'null' is not assignable to type 'SchemaComposer<any>'.

202         const {
                  ~
203           schema,
    ~~~~~~~~~~~~~~~~~
204           schemaCustomization,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205         }: {
    ~~~~~~~~~

packages/gatsby/src/query/graphql-runner.ts:197:17 - error TS2322: Type 'SchemaComposer<any> | null' is not assignable to type 'SchemaComposer<IGatsbyResolverContext<unknown, unknown>>'.
  Type 'null' is not assignable to type 'SchemaComposer<IGatsbyResolverContext<unknown, unknown>>'.

197                 schemaComposer: schemaCustomization.composer,
                    ~~~~~~~~~~~~~~

@vladar vladar removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 20, 2020
@Kornil
Copy link
Contributor Author

Kornil commented May 20, 2020

Thank you! I fixed it by using the non-null assertion.

@Kornil Kornil requested a review from vladar May 20, 2020 12:55
@Kornil Kornil requested a review from ascorbic May 21, 2020 16:57
blainekasten
blainekasten previously approved these changes Jun 16, 2020
Copy link
Contributor

@blainekasten blainekasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, let's merge it!

Thank you so much for contributing to our TypeScript refactor! We have more work to do and we would love to have you stay involved in our transition. Please submit more PRs! 💜

Copy link
Contributor

@blainekasten blainekasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, let's merge it!

Thank you so much for contributing to our TypeScript refactor! We have more work to do and we would love to have you stay involved in our transition. Please submit more PRs! 💜

@blainekasten blainekasten merged commit 670f92f into gatsbyjs:master Jun 16, 2020
@Kornil Kornil deleted the typescript-gatsby-schema-customization branch June 17, 2020 07:00
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.

4 participants