Skip to content

chore(tsconfig): pin browser packages' TS lib to ES2021 - #1946

Open
te6-in wants to merge 2 commits into
devfrom
chore/pin-ts-lib-to-browser-baseline
Open

chore(tsconfig): pin browser packages' TS lib to ES2021#1946
te6-in wants to merge 2 commits into
devfrom
chore/pin-ts-lib-to-browser-baseline

Conversation

@te6-in

@te6-in te6-in commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • 호환성 개선

    • 브라우저 환경에 맞는 TypeScript 설정을 정비해 지원 브라우저에서의 안정적인 빌드와 타입 검사를 강화했습니다.
    • 최신 환경에만 의존하지 않도록 브라우저 호환 기준을 명확히 했습니다.
  • 테스트

    • 테스트 실행 환경에 따라 발생할 수 있는 배열 기능 호환성 문제를 개선했습니다.
    • 빈 결과나 호출 기록도 안전하게 검증하도록 테스트 안정성을 높였습니다.

`.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
@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e5e9e81

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 85730cb2-c501-4b36-9c70-0b0816f76d34

📥 Commits

Reviewing files that changed from the base of the PR and between 6c32fa7 and e5e9e81.

📒 Files selected for processing (7)
  • packages/react-headless/attachment-display/src/useAttachmentDisplay.test.tsx
  • packages/react-headless/pull-to-refresh/src/PullToRefresh.test.tsx
  • packages/react/tsconfig.json
  • packages/stackflow/tsconfig.json
  • packages/utils/dom-utils/tsconfig.json
  • tsconfig.browser.json
  • tsconfig.headless.json

📝 Walkthrough

Walkthrough

브라우저용 공유 TypeScript 설정을 추가하고 관련 패키지에서 상속합니다. 테스트의 Array.prototype.at(-1) 사용을 헬퍼 또는 인덱스 기반 조회로 변경합니다.

Changes

브라우저 TypeScript 설정 및 테스트

Layer / File(s) Summary
브라우저 TypeScript 설정 연결
tsconfig.browser.json, tsconfig.headless.json, packages/react/tsconfig.json, packages/stackflow/tsconfig.json, packages/utils/dom-utils/tsconfig.json
브라우저용 설정이 ES2021, DOM, DOM.Iterable 라이브러리를 지정합니다. 관련 패키지 설정이 이 설정을 상속합니다.
테스트 배열 조회 변경
packages/react-headless/attachment-display/src/useAttachmentDisplay.test.tsx, packages/react-headless/pull-to-refresh/src/PullToRefresh.test.tsx
마지막 호출 조회에 lastCall 헬퍼를 사용합니다. 마지막 배열 요소 조회는 인덱스 기반 접근으로 변경합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 브라우저 패키지의 TypeScript 라이브러리를 ES2021로 고정하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/pin-ts-lib-to-browser-baseline

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Alpha Preview (Storybook)

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Alpha Preview (Stackflow SPA)

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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
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.

1 participant