Skip to content

Wrong completion inside object spread with type annotationΒ #57540

@so1ve

Description

@so1ve

πŸ”Ž Search Terms

spread complete

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play?#code/MYewdgzgLgBAZiEMC8MDeMBGAuGBGGAXwG4AoU0SWTAQwCdc1SBIG3MAVwFtMBTOssxwxOPfmUIp0LNvgA0LAHTKYAelUwAKnQCWAcz38YNDlCSguABwA2vKLxgALfr1IkgA

πŸ’» Code

const foo = { b: 1 };

const bar: {
	a: number;
	b: number;
} = {
	a: 1,
	... // Trigger auto complete here
};

πŸ™ Actual behavior

image

And if you use this completion, the code will become ...,b.

πŸ™‚ Expected behavior

Should complete foo, not b.

Additional information about the issue

The type annotation is necessary to reproduce this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions