3 ms·
It is not just to support the DOM it is also frameworks like JQuery, React, Vue etc. For example the 'options' parameter is a common pattern where an object wi
by goto11 4y ago
It is not just to support the DOM it is also frameworks like JQuery, React, Vue etc.
For example the 'options' parameter is a common pattern where an object with a set of properties are provided to override a some default behavior. So you need to define a Foo type with a set of properties, and then you need to define a type which is like Foo except all properties are optional.
Some frameworks implement their own flavor of inheritance e.g. through mixins. The type of an object with mixins is not just the sum of all properties, you might also have one property overriding a property of a different type in base mixin, so you are adding and removing properties. You need a really powerful type system to be able to represent this.