microsoft / microsoft/TypeScript

Explicit variance annotations for built-in .d.ts files

未关闭
#62,954 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Experimentation Needed In Discussion Suggestion
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

While profiling some projects using typeslayer, I've noticed that according to the type checking traces some time is spent calculating the type variance of common types like Promise<T> and others.

I've explicitly annotated some of these generic types, and I've verified that it that sped up typechecking for some of my complex use-cases.
I've verified that these speed-ups also translate to tsgo by checking with hyperfine.

I'd like to ask if a PR to add explicit type variance to some of the most commonly used library types could be a valuable addition? I could set up a PR so some performance tests could be run to see if it works in aggregate, I just wanted to ask if it's something that aligns with the projects' goals and to maybe understand if this was tried already

Based on my limited understanding the pros would be:

  • More people learning about variance and explicit variance annotations
  • Slightly increased performance in some complex scenarios

The cons would be:

  • Different error messages as now we'd see super and sub prefixes that might confuse users
  • larger size on the wire/disk
  • higher overhead to parse

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件或测试。首先检查内置的 .d.ts 库类型以及 issue 中描述的类型检查跟踪,然后将 tsgo 的测量结果与 hyperfine 进行比较。完成的标准是就常用的目标类型达成一致,并通过性能测试展示其对整体性能和诊断的影响。

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

评估

技术栈
typescript
领域
compilers, performance
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

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