Types not flowing down as expected to sort
#5414
Labels
Duplicate
An existing issue was already created
sort
#5414
I think I've encountered a problem with types flowing down correctly. Take the following code:
The
stringComparer
allows us to sort an array, given a string lambda expression. In this case I'm looking to sort my array of books by their title.However, even though
sort
is expectingcompareFn?: (a: T, b: T) => number
andstringComparer
delivers on that with(obj1:T, obj2: T) => number
there is a problem. The type ofx
inx => x.title
has not flowed though as expected. It is not{title: string}
. It's just{}
.You can see this in the playground here
I'm not certain if this is a but or if I've missed a trick here - I thought I'd best report it just in case.
The text was updated successfully, but these errors were encountered: