Skip to content

Tag: catalan

Type-level Catalan function in TypeScript

Consider the following Catalan function in JavaScript. It returns all the possible ways of associating n applications of a binary operator, where n = xs.length. I want to do something similar, but with types in TypeScript. However, I don’t know how to implement the “else” branch. Any help will be greatly appreciated. By the way, I want to use this