Closed
Description
Bug Report
π Search Terms
Type inferance
π Version & Regression Information
This bug occurs in version 4.5.2;
β― Playground Link
Playground link with relevant code
π» Code
function tIsOfTypeP(t: T): t is P {
// Logic
}
const array: T[] = [...];
// newArray is still of type T[]
const newArray = array
.filter(t => tIsOfTypeP(t));
π Actual behavior
The variable newArray
is of type Array<T>
.
π Expected behavior
The variable newArray
is of type Array<P>
. You know that only elements will remain of type P
.