getsentry / getsentry/sentry-react-native

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

Aperta
#6,657 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
React-Native
Lingua principale
TypeScript
Stelle
1.8k
Fork
366
Merge medio
1g 6h
PR unite (30g)
94

Descrizione

## 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."_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia esaminando il job CI Type Check TypeScript 3.8, il passaggio di build down-level e il mapping typesVersions in packages/core/package.json. Controlla le note di tracciamento dell'alpha in #6656 e la policy sulle versioni di TypeScript nella guida alla migrazione collegata. Il lavoro è completato quando la versione minima è 5.0.4, la vecchia configurazione down-level e il job CI sono stati rimossi o aggiornati e le note di migrazione o di release di v9 documentano l'impatto sugli utenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react-native, typescript
Ambito
build-system, ci-cd, documentation, mobile
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
70/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.