chore(tsconfig): pin browser packages' TS lib to ES2021 - #1946
Conversation
`.at(-1)` shipped to production and crashed every WebView below Chrome 92 / iOS Safari 15.4, because nothing in the repo bounded which JS APIs the supported baseline actually has: `target` is `ESNext` everywhere and `lib` was never set, so the compiler offered the full ESNext surface. Add `tsconfig.browser.json`, extended by every package that ships code to a browser -- the 43 `react-headless/*` packages via `tsconfig.headless.json`, plus `react`, `stackflow`, and `dom-utils`. ES2021 is the newest lib the Chrome 88 / Safari 15 baseline fully supports; ES2022 is where `Array.prototype.at` and `Object.hasOwn` enter. `lynx-react` is left alone -- it targets the Lynx runtime, not a browser. Two test files used `.at(-1)` and are rewritten. No production source needed a change, and no emitted output changes: this bounds APIs only, leaving syntax to `target` and each package's bundler target. Note this fires in the editor and under `tsc -p`, but not in CI: bunchee walks only the entry graph, and these packages have no `typecheck` script. Wiring one up first needs the 34 pre-existing type errors across 20 of the headless packages cleared. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FHxCh49KAYQu8y9nfgYWdH
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthrough브라우저용 공유 TypeScript 설정을 추가하고 관련 패키지에서 상속합니다. 테스트의 Changes브라우저 TypeScript 설정 및 테스트
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Alpha Preview (Storybook)
|
Alpha Preview (Stackflow SPA)
|
Alpha Preview (Docs)
|
The previous wording said the file bounds APIs, which reads as though DOM APIs are covered. They are not: `lib.dom.d.ts` carries no version, so `structuredClone` (Chrome 98) and `scrollend` (Chrome 114) typecheck fine, and no `lib` setting can bound them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FHxCh49KAYQu8y9nfgYWdH
Summary by CodeRabbit
호환성 개선
테스트