keeping types dry

It turns out that with typeof it is possible to keep types dry, for example:

const fn = async (apples: Apples[]) => {  
 const shinyApples: typeof apples = [] //...}  

Sidenote on array mutability: Mutability complects state and time and is thus a form of complexity. Immutable values are simpler and lead to lower accidental complexity.


Would you like to connect? Subscribe via email or RSS , or follow me on Twitter!