angular / angular/components

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

Open
#22,290 13 comments 109 reactions 0 assignees View on GitHub
area: cdk/table feature P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

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

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Angular strictTemplates context and the linked discussions in angular/components#16273 and angular/angular#28731, especially the referenced implementation approach. Determine the affected Material table cell-template typing entry points and how the language service handles them. Done means cell-template variables receive useful compile-time types instead of any, with coverage for the relevant template cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
developer-experience, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.