February 2019
Beginner to intermediate
180 pages
4h 4m
English
Abstract types are type declarations that don't have a definition. Let's explore why this would be useful. In addition to bindings, module signatures can include types. In the following code, you'll notice that the module signature of Foo includes a person type, and now Foo must include this type declaration:
/* Foo.re */type person = { firstName: string, lastName: string};/* Foo.rei */type person = { firstName: string, lastName: string};
The person type is exposed in the same way as if there were no module signature defined. As you'd expect, if a signature is defined and the type is not listed, the type isn't exposed to other modules. There is also the option to leave the type abstract. We only keep what's left of the equals ...
Read now
Unlock full access