You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceObj{}constobj: Obj={};constxs: boolean[]=[false,true,true];constys: Array<Obj|null>=[null,obj,obj];functionidentity(): undefined;functionidentity<T>(x: T): Tfunctionidentity(...args: any[]): any{if(args.length){returnargs[0];}}/** * Or import {identity} from 'lodash/fp'; * * Type definition of LodashIdentity is * * interface LodashIdentity { * (): undefined; * <T>(value: T): T; * } */xs.filter(identity).map(x=>x/* x is still boolean */);ys.filter(identity).map(y=>y/* y is still Obj | null */);
TypeScript Version: 2.8.3
Code
Expected behavior:
x
is inferred astrue
.y
is inferred asObj
.Actual behavior:
x
is stillboolean
.y
is stillObj | null
.Playground Link: Reproduce
The text was updated successfully, but these errors were encountered: