All optimising Javascript runtimes use "shapes" (SpiderMonkey term) or "hidden classes" so that instead of objects being treated as the dictionaries or hashmaps they can instead be treated like fixed regular structs. This makes property lookups much more efficient when you have many objects using the same shape. But notably, simply having the same properties does not ensure that the hidden shape definition will be the same - adding properties to an object in a different order will result in different shapes. This article by Mathias Bynens is a great introduction to the topic.
Are there any static analysis tools for Javascript or Typescript that would warn when inoptimal shapes would be used, such as adding properties in the multiple orders, adding or deleting properties to only some objects in an array, or long chains of property additions which mean changing the shape of an object many times?
I haven't ever heard of anything like an automated tool for this, and it may be that the performance hit of using shapes inoptimally wouldn't be worth the effort of devising such a tool; rather shapes are just something that it helps to develop a sixth sense for, to develop in such a way that you use regular object definitions as much as possible. But if there is such a tool already it would be great to know about.