[microsoft/TypeScript] Explicit variance annotations for built-in .d.ts files (Issue #62954)
DRANK

akaltar created an issue (microsoft/TypeScript#62954) 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 -- Reply to this email directly or view it on GitHub: https://github.com/microsoft/TypeScript/issues/62954 You are receiving this because you are subscribed to this thread. Message ID: <microsoft/TypeScript/issues/62954@github.com>

github.com
Related Topics: TypeScript
1 comments