I tried to figure out a very strange problem that I ran into typescript. It treated the built-in Boolean expression as any first type value instead of the full expression.
So, if you try something simple, like the following:
var numericArray:Array<number> = [2,3,4,1,5,8,11]; var sorrtedArray:Array<number> = numericArray.sort((n1,n2)=> n1 > n2);
Tryit
You will receive an error message in your sorting method, indicating that the parameters do not match any signature of the target, because your result is numeric, not logical. I assume that I am missing something, but I am sure that n1> n2 is a logical expression.
typescript
Kent Cooper Feb 10 2018-11-14T00: 00Z
source share