fix(ts-sdk): align router match nullability types - #1903
Open
11suixing11 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the TypeScript SDK’s router model contract with core by making MatchResult and PriceComparison fields required but nullable, and ensuring router mappers normalize missing values to null (not undefined). This closes the remaining nullability mismatch described in #1401 and #1402.
Changes:
- Make
reasoning,bestBid, andbestAskrequiredT | nullfields inMatchResultandPriceComparisonTypeScript SDK models. - Update router mapping logic so absent match/price fields are emitted as explicit
null. - Add a TypeScript-level regression test to prevent reintroducing optional/undefined drift and to assert mapper normalization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdks/typescript/pmxt/models.ts | Updates public SDK model types so match/price fields are required-but-nullable, matching core’s contract. |
| sdks/typescript/pmxt/router.ts | Normalizes router mapper outputs so missing reasoning/prices become null instead of undefined. |
| sdks/typescript/tests/router-nullability.test.ts | Adds a regression test covering both the type contract (compile-time) and mapper normalization (source-level assertions). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
11suixing11
marked this pull request as ready for review
July 28, 2026 06:08
11suixing11
force-pushed
the
fix/ts-router-nullable-types
branch
from
July 30, 2026 13:52
732df25 to
03544bc
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.
Summary
MatchResultandPriceComparisonexposereasoning,bestBid, andbestAskas required nullable TypeScript SDK fields.nullinstead ofundefined.fetchMarketMatches,compareMarketPrices, andfetchHedges.0during null normalization.Why
Fixes #1401.
Fixes #1402.
mainalready includes| nullfor these fields, so this PR finishes the remaining contract mismatch: core returns the fields as present-but-nullable, while the TypeScript SDK still allowed them to be omitted via?:.Verification
npm ciscripts/fix-generated.jsandscripts/generate-client-methods.jsnpm test --workspace=pmxtjs -- --runTestsByPath tests/router-nullability.test.ts --runInBand(3 tests)npx tsc --noEmit --strict --module CommonJS --target ES2022 --moduleResolution Node --types jest,node tests/router-nullability.test.tsfromsdks/typescript/npm test --workspace=pmxtjs -- --runInBand(18 suites, 96 tests)npm run build --workspace=pmxtjs(CommonJS and ESM)npm test --workspace=pmxt-core -- --runInBand(51 suites, 822 tests; 1 suite and 3 tests skipped)npm test(full repository verification; 267 selected Python SDK tests)git diff --checkNotes
npm cireports existing audit findings; this PR does not change dependencies.