Skip to content

No object literal completions for type parameter constrained to mapped type #16136

Closed

Description

Isolated from this StackOverflow issue

interface Foo {
    foo(): void;
}

declare function f<T extends Partial<Foo>>(x: T): T;

f({
    /*$*/
})

Request completions at the cursor in the above sample.

Expected: foo is a completion.
Actual: No completions.

Activity

  1. changed the title [-]No object literal completions for object constrained to mapped type[/-] [+]No object literal completions for type parameter constrained to mapped type[/+] on May 30, 2017
  2. added
    Bug
    Domain: LS: Completion Lists
    on May 30, 2017
  3. DanielRosenwasser commented on Sep 19, 2017

    @DanielRosenwasser
    MemberAuthor

    I believe that this is because {} fulfills the constraint so that we end up with an inference for T which causes us to give completions from {} instead of the constraint of T.

  4. added
    Suggestion
    and removed
    Bug
    on Apr 12, 2018
  5. added
    Fixed
    on Jul 25, 2025
  6. DanielRosenwasser commented on Jul 25, 2025

    @DanielRosenwasser
    MemberAuthor

    Seems to work now - I feel like Andrew Branch (@andrewbranch) might have fixed this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: LS: Completion ListsExperience EnhancementFixedSuggestion

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions