Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index type for an intersected NoInfer can get sometimes incorrectly deferred #61091

Open
Andarist opened this issue Jan 31, 2025 · 0 comments Β· May be fixed by #61092
Open

Index type for an intersected NoInfer can get sometimes incorrectly deferred #61091

Andarist opened this issue Jan 31, 2025 · 0 comments Β· May be fixed by #61092
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone

Comments

@Andarist
Copy link
Contributor

πŸ”Ž Search Terms

noinfer intersection index type keyof deferred deferral

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.8.0-dev.20250131#code/C4TwDgpgBAKhDOwoF4oGsIgPYDMoAoA5LASQDscIAnAHgG8ocssAuKRKgSzIHMoBfAHxQAZFDr8AlAG4AUAHp5UZQD0A-LNCRYCYACYU6TLgIMmrdsC68Bo8VLmLlUdbKA

πŸ’» 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

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases labels Jan 31, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Projects
None yet
2 participants