microsoft / microsoft/TypeScript
Provide type coverage metrics
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.4k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 117
描述
Search Terms
- type coverage
- flow coverage
Suggestion
I'd love it if TypeScript had a tool to capture type coverage metrics, similar to Flow's Type Coverage feature. That coverage data could be used by IDEs (again, currently supported by Flow) to highlight gaps in type coverage. Basically, it should tell us which parts of our code are being evaluated as any.
Assuming it would work like Flow's feature, this could be a separate tsc option or separate cli command. Theirs works for single files and also offers a batch-coverage command for checking directories / whole projects, etc.
Use Cases
- The Type Coverage metric could be used much like test coverage info, helping us to identify gaps in our typing (particularly unexpected gaps caused by insufficient type definitions from library code).
Examples
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先查看 issue 中链接的 Flow Type Coverage 和 batch-coverage 文档,然后研究 TypeScript 的 tsc 选项或 CLI 命令如何公开等效指标。完成的标准是报告对于单个文件以及目录或整个项目范围的覆盖率,代码的哪些部分会被评估为 any,并提供 IDE 可使用的数据。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100