First, we need a type to represent the companies, which are internet-powered apps. Based on that type, we can think of writing functions that will help us build our logic in a type-safe manner. Let's see how it goes.
As a first attempt, we start small, defining a variant type for the internet companies we are interested in. As we have seen in previous chapters, we will use pattern matching to show the list of apps each of these companies delivers to their users.
We define the internet company type as follows:
type internetCompany =
| Twitter;
Now, we define the function that shows the applications, based on the company, as follows:
let apps = (company: internetCompany) : string => {
switch (company) {
| Facebook => "facebook, messenger, ads"
| Google => "gmail, google+, maps...