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
Jiří Cihelka edited this page Dec 30, 2023
·
2 revisions
Interfaces describe a trait of an object by a set of methods and properties. When we type the parameters of a function, we should always use an interface, not a class. This allows for future implementations of the interface being passed to the function.
Interfaces should be placed in the src/interfaces directory. This directory should contain only interfaces.
Synthetic interfaces
Synthetic interfaces are interfaces that combine multiple existing interfaces into one interface without adding any new methods or properties. The usage of synthetic interfaces is equivalent to the usage of multiple interfaces (they are just more convenient).
Synthetic interfaces should be placed in the src/interfaces/synthetic.ts file.
Runtime interfaces
It can sometimes be useful to check if an object implements an interface at runtime. All objects that implement the GeometryObject interface keep track of which interfaces they implement. The current implementation is a bit unclean and might be refactored in the future (no plans yet).