Skip to content

IntelliSense should suggest all possible object properties for overloaded function #47498

Closed
@leoriviera

Description

@leoriviera

Bug Report

🔎 Search Terms

union of types on function overload
function overloading not showing arguments in object with intellisense

🕗 Version & Regression Information

  • This is the behavior in every version I tried, including 4.5.4 and the nightly, and I reviewed the FAQ for entries about function overloading.

⏯ Playground Link

Playground link with relevant code

💻 Code

type X = {
    a: number;
};

type Y = { 
    a: number;
    b: string;
};

function f(args: X): void;
function f(args: Y): void;

function f(args: X | Y){}

f({
    a: 7,
    |
})

Trigger completions at |

🙁 Actual behavior

No further completion suggestions are returned.

🙂 Expected behavior

A suggestion for both b should be returned as that is a valid option if args is of type Y.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions