Skip to content

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

Open
@devanshj

Description

@devanshj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editor

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions