Fix Shopify Function GraphQL scalar types - #8250
Merged
Merged
Conversation
davejcameron
force-pushed
the
cx-fix-cart-subtotal-decimal
branch
from
August 4, 2026 14:11
6ed9789 to
49966c5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Shopify Function GraphQL type generation by replacing any-typed custom scalar outputs with safer default TypeScript scalar mappings. It does this by generating a temporary codegen config that injects Shopify scalar defaults (and uses unknown as the fallback), while still allowing user-defined mappings to override defaults.
Changes:
- Add default TypeScript mappings for known Shopify Function GraphQL custom scalars, with
defaultScalarTypeset tounknown. - When a
codegenconfig exists in the function’spackage.json, generate a temporary merged codegen config file and rungraphql-code-generatoragainst it. - Update unit tests and add a patch changeset for the user-facing typegen behavior change.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/app/src/cli/services/function/build.ts | Reads codegen from package.json, merges in default scalar mappings, and runs codegen using a temporary config file. |
| packages/app/src/cli/services/function/build.test.ts | Updates mocks/assertions and adds coverage for scalar defaulting and user override behavior. |
| .changeset/curvy-carrots-typegen.md | Adds a patch changeset noting improved scalar type generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
davejcameron
force-pushed
the
cx-fix-cart-subtotal-decimal
branch
from
August 4, 2026 14:18
49966c5 to
6df87eb
Compare
Assisted-By: devx/e85a0d53-5619-4bb5-a163-93bbf6a5c02e
davejcameron
force-pushed
the
cx-fix-cart-subtotal-decimal
branch
from
August 4, 2026 14:48
6df87eb to
ff7745e
Compare
amcaplan
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Shopify Function type generation leaves custom GraphQL scalars as
any, which removes useful type safety from generated JavaScript and TypeScript APIs.WHAT is this pull request doing?
Adds default TypeScript mappings for every custom scalar currently used by Shopify Function schemas. Unknown future scalars fall back to
unknowninstead ofany, while mappings configured by the app developer continue to take precedence.The generated codegen configuration is temporary and does not modify the function project.
How to test your changes?
pnpm --filter @shopify/app vitest run src/cli/services/function/build.test.tspnpm --filter @shopify/app type-checkpnpm --filter @shopify/app lint -- --no-cacheChecklist