angular / angular/components

feat(table): typescript/strong typing of cell templates

Aperta
#22,290 13 commenti 109 reazioni 0 assegnatari Vedi su GitHub
area: cdk/table feature P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### Feature Description

Currently, `*matCellDef` types the resulting variable as `any`:

Screenshot 2021-03-19 at 11 29 32

This issue is an attempt to bring https://github.com/angular/components/issues/16273 back in discussion, which has been closed as Ivy wasn't yet available.

There has been some progress on several fronts:

- Ivy now has `strictTemplates` mode.
- The experimental Ivy powered language server is almost ready to go.

It appears that the approach described in this comment https://github.com/angular/angular/issues/28731#issuecomment-782806178 might allow this to be implemented.

#### Use Case

As we've been converting more code to use Material Data Tables, the lack of strong typing has been really problematic, and it feels like a downgrade in developer experience compared to regular tables with `*ngFor`.

Further motivation for this has been described in:

https://github.com/angular/components/issues/16273
https://github.com/angular/angular/issues/28731

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia esaminando il contesto strictTemplates di Angular e le discussioni collegate in angular/components#16273 e angular/angular#28731, in particolare l’approccio di implementazione a cui si fa riferimento. Determina gli entry point interessati per la tipizzazione dei template delle celle della tabella Material e come li gestisce il language service. Il lavoro è completato quando le variabili dei template delle celle ricevono tipi utili in fase di compilazione invece di any, con copertura dei casi di template pertinenti.

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

Valutazione

Stack tecnologico
angular, typescript
Ambito
developer-experience, frontend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.