Enable `noImplicitAny` in all packages

Aperta
#11,426 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
build-system

Direzione di ricerca

Start by reading the root tsconfig.json to see the noImplicitAny: false line inherited by each package, then pick one of the smallest packages from the table (e.g. ra-data-json-server with 1 error) and reproduce with tsc --noEmit -p packages/ra-data-json-server --noImplicitAny true. Fix the reported TS7006/TS7031 site by making the any explicit rather than narrowing a public signature, enable the flag in that package's tsconfig.json, and confirm the run is clean. Done means the package type-checks with the flag on and its public API types are unchanged.

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

Descrizione

Since the TypeScript 6 upgrade (#11347), the root tsconfig.json enables strict: true but still sets noImplicitAny: false, which disables strict's most important check for every package extending it.

Removing that line produces the following errors in package sources (specs and stories excluded), measured with tsc --noEmit -p packages/<pkg> --noImplicitAny true:

Package Errors
ra-ui-materialui 214
ra-core 206
ra-data-fakerest 22
ra-data-graphql-simple 22
ra-no-code 22
ra-data-local-storage 20
ra-data-graphql 17
ra-input-rich-text 12
ra-i18n-i18next 8
react-admin 8
create-react-admin 6
ra-data-json-server 1
ra-data-local-forage 1

Mostly TS7006 (implicitly-any parameters), then TS7031 (destructured bindings) and TS7053 (index access). Spec and story files will add more.

Suggested approach: one PR per package (small packages first), enabling noImplicitAny in each package's tsconfig.json as it gets fixed, then removing the line from the root config. Public signatures must keep their current types (any made explicit rather than narrowed) to avoid breaking changes.

Lingua principale
TypeScript
Stelle
27k
Fork
5.5k
Merge medio
1g 3m
PR unite (30g)
32

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di marmelab/react-admin

Tutte le issue di marmelab/react-admin

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.