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

Probable bug: Intellisense doesn't work in case of circular type parameter constraints like T extends M<T> #44428

Open
devanshj opened this issue Jun 4, 2021 · 0 comments
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor
Milestone

Comments

@devanshj
Copy link

devanshj commented Jun 4, 2021

Bug Report

πŸ”Ž Search Terms

Circular type parameter constraint, intellisense.
Related - #40439

πŸ•— Version & Regression Information

Tested with version 4.3.2

⏯ Playground Link

Link

πŸ’» Code

declare const m: <T extends M<T>>(m: T) => T
type M<Self, K = Exclude<keyof Self, "k">> =
  { a?: number
  , b?: number
  , c?: number
  , d?: number
  , k?: K
  }

// :)
m({
  a: 1,
  b: 2,
  x: 3,
  // expected suggesstions: c, d, k
  // actual suggesstions: c, d, k
})

// :(
m({
  a: 1,
  b: 2,
  x: 3,
  k: "a",
  // expected suggesstions: c, d
  // actual suggesstions: none
})

πŸ™ Actual behavior

In second function call, intellisense suggested no properties

πŸ™‚ Expected behavior

In second function call, intellisense should suggest properties c and d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor
Projects
None yet
Development

No branches or pull requests

2 participants