Skip to content

refactor: export enums as module namespaces#4740

Open
yaacovCR wants to merge 1 commit into
graphql:17.x.xfrom
yaacovCR:enums
Open

refactor: export enums as module namespaces#4740
yaacovCR wants to merge 1 commit into
graphql:17.x.xfrom
yaacovCR:enums

Conversation

@yaacovCR
Copy link
Copy Markdown
Contributor

TypeKind and DirectiveLocation now use the same representation as Kind: each enum member is a standalone ESM export with a matching type export, re-exported through a module namespace.

This preserves the public TypeKind.SCALAR and DirectiveLocation.FIELD access pattern while avoiding a single object literal that makes all members part of the same runtime value. For example, TypeKind.SCALAR now resolves through the SCALAR named export from typeKind_.ts, which gives bundlers a smaller unit to analyze and tree-shake.

BREAKING CHANGE: TypeKind and DirectiveLocation are now module namespace objects rather than plain object literals.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

@yaacovCR is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@yaacovCR yaacovCR added the PR: breaking change 💥 implementation requires increase of "major" version number label May 14, 2026
TypeKind and DirectiveLocation now use the same representation as Kind: each enum member is a standalone ESM export with a matching type export, re-exported through a module namespace.

This preserves the public TypeKind.SCALAR and DirectiveLocation.FIELD access pattern while avoiding a single object literal that makes all members part of the same runtime value. For example, TypeKind.SCALAR now resolves through the SCALAR named export from typeKind_.ts, which gives bundlers a smaller unit to analyze and tree-shake.

BREAKING CHANGE: TypeKind and DirectiveLocation are now module namespace objects rather than plain object literals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: breaking change 💥 implementation requires increase of "major" version number

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant