Skip to content

feat: upgrade to TypeScript 6.0.3, ES2022 target, and shared ts-config presets#3663

Open
oliverlaz wants to merge 1 commit into
developfrom
typescript-6
Open

feat: upgrade to TypeScript 6.0.3, ES2022 target, and shared ts-config presets#3663
oliverlaz wants to merge 1 commit into
developfrom
typescript-6

Conversation

@oliverlaz

Copy link
Copy Markdown
Member

What & why

Upgrades every workspace to TypeScript 6.0.3 with target: ES2022, and removes tsconfig duplication via a new shared preset package. Enabling type-checking across the previously-unchecked packages also surfaced (and this PR fixes) a pre-existing bug in the core package's published type resolution plus a batch of latent type errors.

Changes

Shared config

  • New private @stream-io/typescript-config workspace (configs/typescript-config/):
    • base.json — cross-cutting policy (ES2022 target, strict, interop, …)
    • library.json — full React Native library config (extends base)
  • Core, the native/expo wrappers, and all 3 example apps extend these instead of duplicating compiler options. Example apps array-extend ["<framework base>", "@stream-io/typescript-config/base.json"].

TypeScript 6.0.3 / ES2022

  • TS 6.0.3 in all 7 manifests; target: ES2022 everywhere.
  • lib kept at ESNext — the SDK uses the ES2023 Array.prototype.toReversed().
  • TS 6.0 no longer auto-includes @types/jest, so it's referenced explicitly from a test-only package/src/__tests__/jest-globals.d.ts (excluded from the published build).

Core publishing fix (consumer-facing)

  • react-native-builder-bob emitted declarations under lib/typescript/src/ while package.json#types pointed at lib/typescript/index.d.ts — so TS consumers couldn't resolve the SDK's types via types. Added rootDir: "./src" so declarations emit flat to match types. This was also the root cause that blocked the wrappers/examples from resolving core's types.
  • Exported PickImageOptions from the core entrypoint (defined+exported in native.ts but never surfaced from index).

Wrappers (stream-chat-react-native, stream-chat-expo)

  • Added a typecheck script + tsconfig (they had neither). The dynamic optional-require shims relax noImplicitAny/strictNullChecks/unused checks (kept noImplicitReturns).
  • Fixed real bugs: missing returns in shareImage, missing resizeMode/rate on the video shim, an inconsistent startRecording return shape.

Example apps

  • Fixed ~60 pre-existing latent type errors unmasked by enabling typecheck: theme palette typing (the legacy flat colors palette, read via a local AppTheme cast — behavior-preserving), null-safety guards, and several SDK-API-drift fixes.

CI

  • check-pr.yml now runs yarn typecheck across the whole workspace (core + 2 wrappers + 3 examples) instead of only the core package; the root typecheck aggregate includes the wrappers.

Verification

  • yarn build
  • yarn typecheck (core + 2 wrappers + 3 examples) ✅ 0 errors
  • yarn lint

Notes for reviewers

  • Commit type: filed as chore: (release-neutral). The core changes (flat types path + PickImageOptions export) are genuinely consumer-facing — if you want them shipped, retype as fix: to cut a patch.
  • Wrapper strictness: strictNullChecks/noImplicitAny are relaxed only for the two wrapper packages (dynamic optional-dep shims), not for core.
  • Example theming: the apps' custom colors palette was already inert for SDK theming (the SDK reads semantics/primitives, not theme.colors); this PR preserves that behavior. Migrating the palette to the token model to restore custom branding would be a separate enhancement.
  • Did not run the full unit suite locally (the only core source change is the additive PickImageOptions export); CI runs test:coverage.

…ig presets

Upgrade every workspace to TypeScript 6.0.3 with ES2022 as the compilation
target, and remove tsconfig duplication via a shared preset package.

- Add private @stream-io/typescript-config workspace exposing base.json
  (ES2022 + strict) and library.json (RN library config). Core, the native and
  expo wrappers, and all three example apps extend these instead of duplicating
  compiler options.
- target is ES2022 everywhere; lib is kept at ESNext because the SDK uses the
  ES2023 Array.prototype.toReversed(). @types/jest is referenced explicitly
  since TS 6.0 no longer auto-includes it from node_modules/@types.
- Fix the core package's published types path: react-native-builder-bob emitted
  declarations under lib/typescript/src while the `types` field pointed at
  lib/typescript/index.d.ts. Adding rootDir "./src" makes them emit flat, which
  also restores type resolution for the wrappers and example apps.
- Export PickImageOptions from the core entrypoint (consumed by the wrappers).
- Add a typecheck to native-package and expo-package and fix latent type errors
  in their optional-dependency shims (missing returns, video shim props).
- Fix pre-existing type errors across the example apps surfaced by enabling
  their typecheck (theme palette typing, null-safety, SDK API drift).
- CI now typechecks the whole workspace (core + wrappers + examples) instead of
  only the core package.
@oliverlaz oliverlaz requested review from isekovanic and szuperaz June 17, 2026 12:25
@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 1894 KB 1894 KB +134 B 🟢

@oliverlaz oliverlaz changed the title chore: upgrade to TypeScript 6.0.3, ES2022 target, and shared ts-config presets feat: upgrade to TypeScript 6.0.3, ES2022 target, and shared ts-config presets Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants