Skip to content

fix(typescript): fix null check for nullable query parameters and passthrough serialization#11411

Closed
jsklan wants to merge 3 commits intomainfrom
devin/1767651110-fix-ts-sdk-test-failures
Closed

fix(typescript): fix null check for nullable query parameters and passthrough serialization#11411
jsklan wants to merge 3 commits intomainfrom
devin/1767651110-fix-ts-sdk-test-failures

Conversation

@jsklan
Copy link
Contributor

@jsklan jsklan commented Jan 5, 2026

Description

Fixes two issues in the TypeScript SDK generator:

  1. TypeScript compilation errors when nullable query parameters (e.g., Date | null | undefined) are used in generated SDKs
  2. Wire test failures where passthrough serialization was preserving both snake_case and camelCase keys (e.g., both version_number and versionNumber appearing in parsed results)

Link to Devin run: https://app.devin.ai/sessions/e8498bbef06245228a6e1502b58d2f36
Requested by: judah@buildwithfern.com (@jsklan)

Changes Made

Fix 1: Nullable Query Parameter Null Check

  • Fixed the null check in GeneratedQueryParams.withQueryParameter() to use != null instead of !== undefined for nullable query parameters
  • This ensures both null and undefined values are properly handled before calling methods like .toISOString() on Date parameters

Before (generated code):

if (fromDate !== undefined) {
    _queryParams.from_date = fromDate.toISOString(); // Error: fromDate could be null
}

After (generated code):

if (fromDate != null) {
    _queryParams.from_date = fromDate.toISOString(); // Safe: null and undefined are both excluded
}

Fix 2: Passthrough Serialization

  • Fixed the passthrough() function in core-utilities to only preserve truly unknown keys
  • Previously, spreading both raw and transformed objects caused duplicate keys with different casing
  • Now filters out known raw/parsed keys before spreading, ensuring only genuinely unknown keys are preserved

Testing

  • Verified fix by regenerating SDK from test fixture and confirming TypeScript build passes
  • All 822 tests pass (including wire tests that were previously failing)
  • Lint checks pass
  • Unit tests added/updated

Human Review Checklist

  • Verify nullable query parameter fix is correct for all nullable types (not just Date)
  • Confirm passthrough fix doesn't break other serialization scenarios that rely on passthrough behavior
  • Verify the type assertions (as Parsed & { [key: string]: unknown }) are safe and don't mask type errors
  • Consider whether a seed test fixture should be added to prevent regressions

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
@devin-ai-integration devin-ai-integration bot changed the title fix(ts-sdk): fix null check for nullable query parameters fix(typescript): fix null check for nullable query parameters and passthrough serialization Jan 5, 2026
@jsklan jsklan closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant