You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constmyMap=newMap([['foo','bar']])// TS thinks this is a Map, but it's not.constmyNewMap={ ...myMap}// myNewMap.get is not a function myNewMap.get('foo')
🙁 Actual behavior
TypeScript thinks get will be present, along with all the other Map properties. Running the code crashes though, because spreading the Map into the object yields an object.
🙂 Expected behavior
I'm not sure if TS mistakenly thinks the new object is a Map, or if is mistakenly grabbing the properties of the Map class, but one way or another it seems like TS should know that that spreading a Map into an object means no more Map properties.
The text was updated successfully, but these errors were encountered:
Bug Report
🔎 Search Terms
Map
Spread
🕗 Version & Regression Information
Not sure when it started, testing on current version. Same behavior observed in Nightly.
⏯ Playground Link
Playground link
💻 Code
🙁 Actual behavior
TypeScript thinks
get
will be present, along with all the other Map properties. Running the code crashes though, because spreading the Map into the object yields an object.🙂 Expected behavior
I'm not sure if TS mistakenly thinks the new object is a Map, or if is mistakenly grabbing the properties of the Map class, but one way or another it seems like TS should know that that spreading a Map into an object means no more Map properties.
The text was updated successfully, but these errors were encountered: