Closed
Description
I made function SortFilter like this
/**
* @param {T[]} arr
* @template T
*/
function ItIs(arr) // for test
{
return arr;
}
/**
* @param {T[]} arr
* @param {function(T):number} valuator
* @template T
*/
function SortFilter(arr,valuator)
{
return arr.map((item) => {
return { item: item,value: valuator(item) };
}).filter((pair) => Number.isFinite(pair.value)).sort((l,r) => {
return l.value - r.value;
}).map((pair) => pair.item);
}
And this is the result
As you could see. It seem like it only parse correctly when param is normal array. And fail with callback function as param
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
DanielRosenwasser commentedon Oct 19, 2016
Interestingly, if you write
you'll get
number[]
.Additionally, with the following
If you request quick info on
x
and then onq
,q
will correctly get the typenumber
(thoughx
will still have the typeT[]
.But if you reverse the order (request quick info on
q
and thenx
), then you will get typeT[]
onx
andT
forq
.Though this might be unrelated, it'd make for a good test case.
Thaina commentedon Oct 19, 2016
Talk about order of evaluation. I remembered this is used to work in 1.8-1.9
There is another bug I found that it may related. I like to make a chain promise with reduce
It seem like order of evaluation for salsa in typescript v2 was changed. So it cause problem on generic guess work
sandersn commentedon Dec 16, 2016
The problem is that
isSymbolInScopeOfMappedTypeParameter
doesn't know about JSDoc. This function skips instantiation for type parameters that aren't even in scope. Unfortunately, it thinks that JSDoc type parameters are not in scope!sandersn commentedon Dec 16, 2016
Fix is up at #12982