Assume I have such code:
function concat(a: string, b: string):string {
return a + b;
}
function firstPlusWorld(items: string[]):string {
return concat(items[0], ' World');
}
console.log(firstPlusWorld([]));
In this case typescript won't argue that the first argument passed to concat is not a string.
In functional land there is Maybe type and head function has type signature
head :: List a -> Maybe a
Is there any way to make typescript handle such cases?