Microsoft/TypeScript
在 GitHub 查看Index type for an intersected `NoInfer` can get sometimes incorrectly deferred
Open
#61,091 创建于 2025年1月31日
Domain: Index TypesHelp WantedPossible Improvement
仓库指标
- Star
- (48,455 star)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 9 个 PR)
描述
🔎 Search Terms
noinfer intersection index type keyof deferred deferral
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
type Test = keyof (NoInfer<{ foo: string }> & {});
// ^? type Test = keyof (NoInfer<{ foo: string; }> & {})
type Test2 = keyof ({ foo: string } & {});
// ^? type Test2 = "foo"
🙁 Actual behavior
Test is a deferred index type
🙂 Expected behavior
Test shouldn't be a deferred index type but a "foo" literal, just like Test2.
Additional information about the issue
No response