getsentry / getsentry/sentry-react-native

Raise minimum TypeScript to 5.0.4 and drop TS 3.8 support (v9)

Open
#6,657 1 comment 0 reactions 0 assignees View on GitHub
React-Native
Dominant language
TypeScript
Stars
1.8k
Forks
366
Avg merge
1d 9h
Merged PRs (30d)
89

Description

## Summary

Raise the React Native SDK's minimum supported **TypeScript version to `5.0.4`** and drop the TypeScript 3.8 down-leveling setup.

> **Target: v9 (next major).** This is a breaking change and will be implemented as part of the v9 major, alongside the `@sentry/*` JavaScript SDK v11 bump.

## Background

JavaScript SDK v11 raises its minimum TypeScript to **`5.0.4`** and **stops emitting down-leveled types** ([migration guide — TypeScript Version Policy](https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md)). Confirmed against the alpha: `@sentry/core@11.0.0-alpha.2` no longer ships the `typesVersions` / `types-ts3.8` fallback that v10 provided for TS `<5.0`.

Because the RN SDK re-exports and references `@sentry/core` types, its effective TypeScript floor is inherited from core. The v11 core `.d.ts` files use TS 4.0/4.5+ syntax (labeled tuple elements; inline `type` import specifiers) that older TypeScript cannot parse — this is what fails the `Type Check TypeScript 3.8` CI job on the alpha.2 spike (#6655). Our own `downlevel-dts` step only rewrites the RN SDK's own declarations; it does not (and cannot practically) rewrite the transitive `@sentry/core` types.

See the alpha.2 tracking notes in #6656.

## Is `5.0.4` viable for React Native?

Yes. `5.0.4` is exactly the TypeScript version the RN community template pinned for **RN 0.73–0.76**; RN 0.77+ ships newer (`^5.8.x`). RN 0.71/0.72 templated TS 4.8.4, but TypeScript is decoupled from the RN version and can be bumped independently.

## User impact

Compile-time only, TypeScript users only:
- **Not affected:** JavaScript-only users, and TypeScript users already on `>= 5.0.4` (the majority).
- **Affected:** TypeScript users below `5.0.4` — they must bump `typescript` (a devDependency change, independent of their RN version). No runtime/behavior impact.

The SDK's `react-native` peer floor stays `>= 0.65.0`: the SDK still *runs* on old RN, but its *types* will require TS 5.0.4.

## Tasks

- [ ] Raise the minimum supported TypeScript to `5.0.4`.
- [ ] Remove the down-level setup: the `downlevel` build step, the `downlevel-dts` devDependency, and the `typesVersions` `<4.9 → ts3.8` mapping in `packages/core/package.json`.
- [ ] Replace/retire the `Type Check TypeScript 3.8` CI job with one pinned to the new `5.0.4` floor.
- [ ] Document in the v9 migration guide / release notes: _"Minimum TypeScript raised to 5.0.4 (following `@sentry/core` v11); React Native support unchanged (`>= 0.65`). TypeScript users below 5.0.4 must upgrade TypeScript — this does not require a React Native upgrade."_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Type Check TypeScript 3.8 CI job, the downlevel build step, and the typesVersions mapping in packages/core/package.json. Check the alpha tracking notes in #6656 and the TypeScript version policy in the linked migration guide. Done means the floor is 5.0.4, the old down-level setup and CI job are retired or updated, and v9 migration or release notes document the user impact.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
build-system, ci-cd, documentation, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.