Module Type Structure
Every interface in a Web API module can potentially contain methods. These methods are modeled in a separate module named after the interface.
The primary reason for this separation is to handle method overloads. As explained in the Design Philosophy section, ReScript does not permit records to define the same properties more than once. Therefore, methods with overloads cannot be modeled within the same record type.
Bindings
Another advantage of having a separate file is that these bindings can utilize all types defined in the API module.
Under normal circumstances, the type module only contains @send
bindings where the type is the first parameter.
DirectoryDOMAPI
- HTMLButtonElement.res
Inheritance
When an interface inherits from another interface, the base interface methods can be included into the inheriting interface.
All methods from HTMLElement should also be available on HTMLButtonElement.