Skip to content

fix: run type tests under TypeScript 6 and add missing response fields#1780

Merged
oliverlaz merged 3 commits into
masterfrom
fix/ts6-type-gen-tsconfig
Jun 22, 2026
Merged

fix: run type tests under TypeScript 6 and add missing response fields#1780
oliverlaz merged 3 commits into
masterfrom
fix/ts6-type-gen-tsconfig

Conversation

@oliverlaz

@oliverlaz oliverlaz commented Jun 22, 2026

Copy link
Copy Markdown
Member

CLA

  • I have signed the Stream CLA (required).
  • Code changes are tested

Description of the changes, What, Why and How?

Two related changes, both driven by getting yarn test-types healthy again.

1. Run the API type-definition tests under TypeScript 6

What / Why. TypeScript was bumped to ^6.0.3 in #1742. TS6 makes it a hard error (TS5112) to specify files on the command line while a tsconfig.json is in scope:

error TS5112: tsconfig.json is present but will not be loaded if files are
specified on commandline. Use '--ignoreConfig' to skip this error.

run-types-gen did exactly that (tsc … test/typescript/*.ts), so every yarn test-types run failed. (It only ever surfaced in the weekly Scheduled tests job — type.yml is disabled — and the 3× retry can't help a deterministic error.)

How.

  • run-types-gen now runs tsc -p test/typescript/tsconfig.json (project mode — no files on the command line, so no TS5112).
  • That config now extends the root tsconfig.json so module resolution (moduleResolution: bundler) and skipLibCheck match what yarn build emits — without it, tsc's bare CLI defaults fail on TS1340 for the emitted import("ws") type in dist/types/insights.d.ts.
  • Added noEmit: true (the old config had none, so on error tsc emitted stray .js files).

The SDK source itself was already TS6-clean (yarn types/build/lint/unit tests all pass under TS 6.0.3).

2. Add missing fields to API response types

With the type tests running again, they surfaced three fields the live API returns that the SDK response types didn't declare (the same drift already failing the scheduled job back in May). Added as optional fields:

  • received_atConnectionOpen
  • is_confusable_folding_enabledBlockList / BlockListResponse
  • feed_audit_logs_enabledAppSettingsAPIResponse.app

Verification

  • Local (TS 6.0.3): TS5112 gone; run-types-gen confirmed to still catch drift; all three new fields recognized after rebuild; yarn types, yarn build, yarn lint, yarn vitest run green.
  • End-to-end: ran the real yarn test-types against the live API by dispatching the Scheduled tests workflow on this branch. The first run proved TS5112 was gone and failed only on the three drift fields above; a follow-up run after adding the fields confirms the result (see comments).

Changelog

  • Add optional received_at (ConnectionOpen), is_confusable_folding_enabled (BlockList/BlockListResponse) and feed_audit_logs_enabled (app settings) to the response types.
  • Internal: the API type-definition tests (yarn test-types) now run under TypeScript 6.

TypeScript 6 makes it a hard error (TS5112) to pass files on the command line
while a tsconfig.json is in scope, which broke `yarn test-types`: its
run-types-gen step ran `tsc … test/typescript/*.ts`.

Switch run-types-gen to project mode (`tsc -p test/typescript/tsconfig.json`)
and have that config extend the root tsconfig so module resolution and
skipLibCheck match `yarn build` (otherwise the emitted `ws` type trips TS1340).
Add noEmit so the type-check never writes stray .js files next to the sources.

The SDK source itself already type-checks and builds clean under TS 6.0.
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Size Change: 0 B

Total Size: 408 kB

ℹ️ View Unchanged
Filename Size
dist/cjs/index.browser.js 136 kB
dist/cjs/index.node.js 137 kB
dist/esm/index.mjs 135 kB

compressed-size-action

@oliverlaz

Copy link
Copy Markdown
Member Author

End-to-end verification

Dispatched the Scheduled tests workflow against this branch to run the real yarn test-types against the live API (run):

  • No TS5112 — the type-gen now runs under TypeScript 6 (the breakage this PR fixes).
  • ✅ Live-API fixture generation (run-test-types) completed and run-types-gen type-checked the freshly generated data.ts.
  • ⚠️ The run's overall conclusion is failure, but only on pre-existing live-API/type drift the now-working test correctly flags — unrelated to this PR and to TS6:
    • received_at not in ConnectionOpen
    • is_confusable_folding_enabled not in BlockListResponse / BlockList
    • feed_audit_logs_enabled not in the app-settings (getConfig) type

received_at and feed_audit_logs_enabled were already failing the weekly scheduled job in May, before the TS6 bump — so this PR neither causes nor is blocked by them. Updating the SDK response types for these fields is tracked separately.

Running the type tests end-to-end under TypeScript 6 surfaced three fields the
backend returns that the SDK response types did not declare:

- received_at on ConnectionOpen
- is_confusable_folding_enabled on BlockList (and BlockListResponse)
- feed_audit_logs_enabled on AppSettingsAPIResponse.app

All added as optional fields.
@oliverlaz oliverlaz changed the title test: run API type-definition tests via project tsconfig (TS6 compat) fix: TypeScript 6 compat for type tests and missing API response fields Jun 22, 2026
Found by running the type tests against the live API; value is null, so typed boolean | null.
@oliverlaz oliverlaz changed the title fix: TypeScript 6 compat for type tests and missing API response fields fix: run type tests under TypeScript 6 and add missing response fields Jun 22, 2026
@oliverlaz

Copy link
Copy Markdown
Member Author

Confirmed green end-to-end ✅

Re-ran the Scheduled tests workflow on this branch after adding all the response fields — it passes (conclusion: success). The full yarn test-types (live-API fixture generation for all generators including the multitenancy syncTeam + type-check) is green.

All four previously-undeclared fields are resolved. The app-settings object was diffed against the real API response (53 keys) to confirm moderation_onboarding_complete was the last missing one — no remaining drift.

@oliverlaz oliverlaz merged commit 8e49611 into master Jun 22, 2026
9 of 10 checks passed
@oliverlaz oliverlaz deleted the fix/ts6-type-gen-tsconfig branch June 22, 2026 12:19
github-actions Bot pushed a commit that referenced this pull request Jun 22, 2026
## [9.47.1](v9.47.0...v9.47.1) (2026-06-22)

### Bug Fixes

* avoid sorting unless we match a command ([#1775](#1775)) ([b9acab4](b9acab4))
* run type tests under TypeScript 6 and add missing response fields ([#1780](#1780)) ([8e49611](8e49611))
@stream-ci-bot

Copy link
Copy Markdown

🎉 This PR is included in version 9.47.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants