Closed
Description
TypeScript Version: 2.0.10
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"strictNullChecks": true,
"noImplicitAny": false,
"sourceMap": false
}
}
Code
const mixed = [1, 'one', null, undefined];
const $ = Observable.of(...mixed)
.filter(x => x !== null)
.filter(x => x !== undefined)
.filter(x => typeof x !== 'string');
$.subscribe(x => console.log(x)); // 1
Expected behavior:
$ is in type (number)
Actual behavior:
$ is in type (string | number | null | undefined)
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
HerringtonDarkholme commentedon Dec 7, 2016
Related: #9998 (comment)
mhegazy commentedon Dec 8, 2016
there is not a way to represent this transformation to the type system. an option would be something like #12424
goldenbearkin commentedon Jan 26, 2017
@mhegazy Could you please explain a little bit more? I still can't get my head around after looking at #12424...