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

Object spread and Map #33081

Closed
bs85 opened this issue Aug 26, 2019 · 3 comments
Closed

Object spread and Map #33081

bs85 opened this issue Aug 26, 2019 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@bs85
Copy link

bs85 commented Aug 26, 2019

When spreading a Map, the resulting object is also considered a Map, allowing to call all the Map methods on it even though they aren't inherited.

const map: Map<number, string> = new Map();
const spread = { ...map };
spread.has(0)

// -> spread.has is not a function

Is this intended, and is there a compiler option that would result in an error here?

@AnyhowStep
Copy link
Contributor

AnyhowStep commented Aug 26, 2019

#28801

#9726

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Aug 26, 2019
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

1 similar comment
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants