feat: upgrade to TypeScript 6.0.3, pin ES2022, raise supported-browser floors#2290
feat: upgrade to TypeScript 6.0.3, pin ES2022, raise supported-browser floors#2290oliverlaz wants to merge 2 commits into
Conversation
…er floors - Bump typescript to ^6.0.3 across all workspaces - Pin target/module/lib to ES2022; with no transpilation in the build, this prevents post-ES2022 APIs from shipping unpolyfilled - Add shared @stream-io/typescript-config (base + library-web/library-rn + app-web); adopt across the libraries and Vite sample apps - Migrate TS 6.0 deprecations instead of suppressing them: moduleResolution node10 -> bundler, esModuleInterop false -> true - Add @types/node + types:["node"] where Node globals are used (TS 6.0 dropped @types auto-inclusion); add rootDir for builder-bob d.ts builds - Raise isSupportedBrowser floors: Chrome/Edge/Android WebView 136, Firefox 137, Safari 18 - Replace post-ES2022 APIs the lib pin caught: Set.difference (ES2025), Array.findLastIndex (ES2023) - React Native: jsx "react-native"; ReturnType<typeof setTimeout> over NodeJS.Timeout; globalThis over global - Quarantine one flaky live-backend ringing integration test
|
📝 WalkthroughWalkthroughIntroduces a new ChangesTypeScript 6 migration and shared tsconfig adoption
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Aligns the RN SDK with the other React Native packages, which already use bob ^0.41.0. bob 0.41 defaults to the automatic JSX runtime, so the published output now uses jsx() from react/jsx-runtime instead of React.createElement. ESM output and production mode are preserved.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sample-apps/react-native/dogfood/src/screens/LoginScreen/index.tsx (1)
38-89:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winClear the pending tap timer on unmount.
tapTimerRefis set at Line 38 and reused inhandleImagePress, but there’s no lifecycle cleanup. If the screen unmounts within 500ms, the callback can still fire and update state/store.Suggested fix
-import React, { useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; @@ const tapTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); + + useEffect(() => { + return () => { + if (tapTimerRef.current) { + clearTimeout(tapTimerRef.current); + tapTimerRef.current = null; + } + }; + }, []);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sample-apps/react-native/dogfood/src/screens/LoginScreen/index.tsx` around lines 38 - 89, The tapTimerRef timer is set in the handleImagePress function but is never cleaned up when the LoginScreen component unmounts. This can cause the setTimeout callback to execute after unmount and attempt to update state/store. Add a useEffect hook with an empty dependency array that returns a cleanup function to check if tapTimerRef.current exists and clear it using clearTimeout to prevent stale callbacks from firing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/client/src/rtc/helpers/sdp.ts`:
- Around line 161-166: The issue is that splitting the fmtp configuration
strings on semicolons without trimming whitespace causes profile matches to fail
when there are spaces around the delimiters. In the code where required is
created by splitting fmtpProfileToKeep on semicolons (line 161), and where
actual is created by splitting fmtp.config on semicolons (line 163), each
resulting string segment needs to be trimmed to remove leading and trailing
whitespace. Apply trim() to each element after the split operations on both the
required array and the actual Set to ensure that functionally equivalent profile
configurations with different whitespace are properly recognized as matches.
---
Outside diff comments:
In `@sample-apps/react-native/dogfood/src/screens/LoginScreen/index.tsx`:
- Around line 38-89: The tapTimerRef timer is set in the handleImagePress
function but is never cleaned up when the LoginScreen component unmounts. This
can cause the setTimeout callback to execute after unmount and attempt to update
state/store. Add a useEffect hook with an empty dependency array that returns a
cleanup function to check if tapTimerRef.current exists and clear it using
clearTimeout to prevent stale callbacks from firing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f51bbd79-3050-4262-8614-52cc117dd2b4
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (84)
package.jsonpackages/audio-filters-web/package.jsonpackages/audio-filters-web/tsconfig.jsonpackages/audio-filters-web/vite.config.tspackages/client/package.jsonpackages/client/src/Call.tspackages/client/src/StreamSfuClient.tspackages/client/src/coordinator/connection/connection.tspackages/client/src/helpers/MediaPlaybackWatchdog.tspackages/client/src/helpers/__tests__/browsers.test.tspackages/client/src/helpers/browsers.tspackages/client/src/rtc/helpers/degradationPreference.tspackages/client/src/rtc/helpers/sdp.tspackages/client/src/rtc/helpers/tracks.tspackages/client/tsconfig.jsonpackages/noise-cancellation-react-native/package.jsonpackages/noise-cancellation-react-native/tsconfig.jsonpackages/react-bindings/package.jsonpackages/react-bindings/src/i18n/StreamI18n.tspackages/react-bindings/tsconfig.jsonpackages/react-native-callingx/package.jsonpackages/react-native-callingx/tsconfig.jsonpackages/react-native-sdk/expo-config-plugin/tsconfig.jsonpackages/react-native-sdk/package.jsonpackages/react-native-sdk/src/components/Call/CallContent/CallContent.tsxpackages/react-native-sdk/src/components/Livestream/HostLivestream/HostLivestream.tsxpackages/react-native-sdk/src/components/Livestream/LivestreamControls/ViewerLivestreamControls.tsxpackages/react-native-sdk/src/components/Livestream/LivestreamTopView/DurationBadge.tsxpackages/react-native-sdk/src/components/Livestream/ViewerLivestream/ViewerLivestream.tsxpackages/react-native-sdk/src/components/Participant/ParticipantView/ParticipantReaction.tsxpackages/react-native-sdk/src/components/Participant/ParticipantView/VideoRenderer/index.tsxpackages/react-native-sdk/src/hooks/useModeration.tspackages/react-native-sdk/src/utils/StreamVideoRN/index.tspackages/react-native-sdk/src/utils/internal/registerSDKGlobals.tspackages/react-native-sdk/src/utils/push/libs/firebaseMessaging/index.tspackages/react-native-sdk/tsconfig.jsonpackages/react-sdk/package.jsonpackages/react-sdk/src/embedded/hooks/useWakeLock.tspackages/react-sdk/src/embedded/livestream/viewer/ViewerLobby.tsxpackages/react-sdk/src/wrappers/LivestreamPlayer/LivestreamPlayer.tsxpackages/react-sdk/tsconfig.jsonpackages/typescript-config/app-web.jsonpackages/typescript-config/base.jsonpackages/typescript-config/library-rn.jsonpackages/typescript-config/library-web.jsonpackages/typescript-config/package.jsonpackages/video-filters-react-native/package.jsonpackages/video-filters-react-native/tsconfig.jsonpackages/video-filters-web/package.jsonpackages/video-filters-web/tsconfig.jsonsample-apps/client/ts-quickstart/package.jsonsample-apps/client/ts-quickstart/tsconfig.jsonsample-apps/react-native/dogfood/package.jsonsample-apps/react-native/dogfood/src/components/CallControlls/MoreActionsButton/index.tsxsample-apps/react-native/dogfood/src/screens/LoginScreen/index.tsxsample-apps/react-native/expo-video-sample/package.jsonsample-apps/react-native/ringing-tutorial/package.jsonsample-apps/react/audio-rooms/package.jsonsample-apps/react/audio-rooms/src/components/Room/SpeakingRequestsList.tsxsample-apps/react/audio-rooms/tsconfig.jsonsample-apps/react/audio-rooms/tsconfig.node.jsonsample-apps/react/cookbook-participant-list/package.jsonsample-apps/react/cookbook-participant-list/tsconfig.jsonsample-apps/react/cookbook-participant-list/tsconfig.node.jsonsample-apps/react/egress-composite/package.jsonsample-apps/react/egress-composite/src/components/layouts/EgressReadyParticipantViewUI.tsxsample-apps/react/egress-composite/tsconfig.jsonsample-apps/react/egress-composite/tsconfig.node.jsonsample-apps/react/livestream-app/package.jsonsample-apps/react/livestream-app/src/viewers/HLSLivestream.tsxsample-apps/react/livestream-app/tsconfig.jsonsample-apps/react/livestream-app/tsconfig.node.jsonsample-apps/react/messenger-clone/package.jsonsample-apps/react/messenger-clone/tsconfig.jsonsample-apps/react/messenger-clone/tsconfig.node.jsonsample-apps/react/react-dogfood/components/Ringing/DialerPage.tsxsample-apps/react/react-dogfood/package.jsonsample-apps/react/react-dogfood/tsconfig.jsonsample-apps/react/stream-video-react-tutorial/package.jsonsample-apps/react/stream-video-react-tutorial/tsconfig.jsonsample-apps/react/stream-video-react-tutorial/tsconfig.node.jsonsample-apps/react/zoom-clone/package.jsonsample-apps/react/zoom-clone/tsconfig.jsonsample-apps/react/zoom-clone/tsconfig.node.json
💤 Files with no reviewable changes (1)
- packages/react-native-sdk/src/utils/StreamVideoRN/index.ts
💡 Overview
Upgrades the monorepo to TypeScript 6.0.3, pins the compilation
target/module/libto ES2022, introduces a shared TypeScript config package, and raises the supported-browser floors.📝 Implementation notes
TypeScript 6.0.3 across all workspaces (root + packages + sample apps).
ES2022 everywhere.
target,module, andlibare pinned to ES2022. The build does no transpilation (rollup / vite / Metro pass the TS output through), solib: esnextwould let post-ES2022 APIs type-check and then ship unpolyfilled, breaking the supported browsers. The pin already caught and replaced two real cases:Set.difference(ES2025) in@stream-io/video-clientArray.findLastIndex(ES2023) in thereact-dogfoodsampleShared config. New private
@stream-io/typescript-config(base+library-web+library-rn+app-web), adopted by the 9 libraries and 8 sample apps. Removes ~16 duplicated compiler options per package and fixes the drift it surfaced (mixedesModuleInterop,jsx,moduleResolution).react-dogfood(Next.js) stays on its own Next-managed tsconfig but follows the ES2022libpin.TS 6.0 deprecations migrated, not suppressed:
moduleResolution: "node"(node10) to"bundler"esModuleInterop: falsetotruerootDirfor thereact-native-builder-bob.d.tsbuilds (TS 6.0 requires it)@types/node+types: ["node"]where Node globals are used (TS 6.0 dropped@typesauto-inclusion)Supported browsers (
isSupportedBrowser): Chrome / Edge / Android WebView 136, Firefox 137, Safari 18. iOS WebKit engine floor unchanged at 605.React Native:
jsx: "react-native";ReturnType<typeof setTimeout | setInterval>instead ofNodeJS.Timeout;globalThisinstead ofglobal.Also includes the strict-flag fixes (e.g. explicit returns for
noImplicitReturns) that accompany the shared base's stricter compiler options, and quarantines one flaky live-backend ringing integration test.Verification.
NODE_ENV=production yarn build:all,yarn lint:ci:all, andyarn test:react-native:sdkall pass.yarn test:ci:clientpasses except a pre-existing flaky live-backend integration test (api.test.ts > query calls, a 504 from the backend).Deliberate follow-ups (out of scope):
verbatimModuleSyntaxandnoUncheckedIndexedAccesssweeps for the web packages (measured at roughly 400-700 and 100-200 fixes respectively; better as standalone PRs).🎫 Ticket: https://linear.app/stream/issue/XYZ-123
📑 Docs: https://github.com/GetStream/docs-content/pull/1375
Summary by CodeRabbit