fix(commerce-elastic-path): declare every /server export in server.d.ts - #560
Merged
Merged
Conversation
dist/server.d.ts is not derived from src/server.ts — it is a template string in build-server.mjs, hand-mirrored from the source, and it had drifted. 17 of the entry's 105 exports shipped working JavaScript with no type, so importing any of them failed a consumer's typecheck while the runtime worked. The example app imports createManualAdapter, handleResumePayment and handleAbandonPayment from /server, so bumping it to 0.6.0 would have broken next build on three counts. Declares all 105 rather than only this release's additions: the six that predate it are equally unusable, and two of them are what the example app needs. The SSR cart-seed helpers are documented for use in a consumer's root layout, so they are public API too.
field123
force-pushed
the
fix/server-dts-generation
branch
from
September 15, 2026 13:57
14d4982 to
439ccb3
Compare
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.
dist/server.d.tsis not derived fromsrc/server.ts— it is a template string insidebuild-server.mjs, hand-mirrored from the source, and it had drifted. 17 of the entry's 105 exports shipped working JavaScript with no type declaration, so importing any of them failed a consumer's typecheck while the runtime worked fine.The example app imports
createManualAdapter,handleResumePaymentandhandleAbandonPaymentfrom/server, so bumping it to 0.6.0 would have brokennext buildon three counts. Itstsconfig.jsonsetsstrict: trueandnext.config.jssets notypescript.ignoreBuildErrors.Caught by building 0.6.0 locally before publishing. 0.6.0 is not yet on npm.
Scope
Declares all 105 exports rather than only this release's additions. An earlier revision deferred the six that predate 0.6.0 on the grounds that they are equally broken in published 0.5.3 and so not a regression — but two of them are exactly what the example app needs, and the SSR cart-seed helpers (
seedCartFallback,EP_CART_CACHE_KEY,epCartCacheKey,EpCartCacheKey) are documented insrc/server.tsfor use in a consumer's root layout, so they are public API too. "Not a regression" is not the same as "usable".No CHANGELOG entry: the defect existed only inside the unpublished release branch, so it never reached a consumer and has nothing to announce.
Verified
Packed the built tarball and typechecked a consumer importing every export, each value as a value and each type as a type, under
strict+isolatedModules:tscexits 0 across all 105TS2305on the 17 undeclared namesTS1361/TS2693, which is what anexport {}/export type {}inversion would produceKnown, not addressed
CustomAttributeAllowListis declared in the template but is not an export ofsrc/server.ts. It predates this change, it is type-only, and it resolves — but it means the declared surface is one name wider than the source. Removing it would narrow a type surface already shipped in 0.5.3, so it is left alone.Nothing guards against a fourth drift: no test asserts template/source parity, and
publintruns only fromprepublishOnly, never in CI. Generating the declaration fromsrc/server.ts, or a parity unit test, would close the failure mode — both belong in their own change rather than a release path.Refs #557, #559