Microsoft/TypeScript
Auf GitHub ansehenIndex type for an intersected `NoInfer` can get sometimes incorrectly deferred
Open
#61.091 geöffnet am 31. Jan. 2025
Domain: Index TypesHelp WantedPossible Improvement
Repository-Metriken
- Stars
- (48.455 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)
Beschreibung
🔎 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