- GitHub - gvergnaud/hotscript: A library of composable functions for the type-level! Transform your TypeScript types in any way you want using functions you already know.
- A library of composable functions for the type-level! Transform your TypeScript types in any way you want using functions you already know. - gvergnaud/hotscript
Let's take an example of a piece of code.
It's a code that converts the first letter of each word to UpperCase.
It's simple, but this makes the return type string, and type inference becomes impossible.
Of course, you can type each type one by one like above.
However, the above type feels less readable. Nested ternary operators and recursive structures are the problem, right?
But surprisingly, TypeScript supports higher-order types.
And there's a higher-order type library based on that higher-order type.
You can use this library to neatly organize type definitions.
The code is here.
In this way, we can organize types in a more readable way using higher-order types.
There are various other features, so it's good to visit the site, take a look around, and use it when you need it.
Comments0