Day 15. We are dealing with string inference combined with recursions.
Since I don't want to deal with some funny cases, I just implemented hacky helper functions to deal with it (don't do this 😂)
Since I don't want to deal with some funny cases, I just implemented hacky helper functions to deal with it (don't do this 😂)
Comments
To avoid type narrowing for string utilities, we can recast it using string utility types.
The trick is to assert whether the generic is provided or not. If it's not provided, access the array element. Otherwise, return the generic as-is.
We can check if an element exist in an array using `extends`