angular / angular/components

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

未关闭
#22,290 13 条评论 109 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/table feature P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

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

贡献指南

打开贡献指南

调研方向

首先检查 Angular 的 strictTemplates 上下文,以及 angular/components#16273 和 angular/angular#28731 中的相关讨论,尤其是其中引用的实现方法。确定受影响的 Material table 单元格模板类型推断入口,以及 language service 如何处理这些入口。完成标准是:单元格模板变量获得有用的编译时类型,而不是 any,并覆盖相关的模板情况。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
developer-experience, frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。