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
// Correctly infers type as stringconstworks: string[]=[...Array(5)].map(v=>{if(v%2===0){return'a string';}returnnull;}).filter(v=>!!v);// Doesn't work for some reason even though its basically the sameconstdoesntWork1: string[]=[...Array(5)].map(v=>{if(v%2===0){return'a string';}returnnull;}).filter(v=>v);// Cant infer Boolean workingconstdoesntWork2: string[]=[...Array(5)].map(v=>{if(v%2===0){return'a string';}returnnull;}).filter(Boolean);constdoesntWork3: string[]=[...Array(5)].map(v=>{if(v%2===0){return'a string';}returnnull;}).filter(v=>Boolean(v));
π Actual behavior
See playground; it can't infer types properly.
π Expected behavior
All have the same type
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
Inferred Type Predicates Boolean
π Version & Regression Information
This is a new issue introduced in 5.5
β― Playground Link
https://www.typescriptlang.org/play/?isolatedDeclarations=true#code/PTAEGEHsCdoUwMYBcA2BPUBLAdgMztAM6hJoAOcoAhsYUtDgOYBQCk2doA7jANaEAuUHQbZGAbQC6oALyhxAOiUBBWFTQAKAKwBKSc1CHQCgLZUyGgG6yAfKADeBo88y5QV0AFIATLJlyABh0HJ2cw0HgkAFdobFAAcipheiZ4gG5QsIBfZkznSJi47CiUFAznLJ1MhVxMFCQCDxk7AEIWyx0M5hBQABFIOEJseKRuPlBcGGFIE0p4GnZQOEs4OKQAC0goxnWsJGIAIxpMBCpSjA3KQipZ1nZOABMBoaQAdT4ARiERJilZeSUClU0HU2j01TMFmszRC4UMrnc1h8fkCwUccLCBViCSSPzE6TyRhyhMMWKKJTKmUq1Vq9Ua0LsHS6PXAVGwoxw+GgoAAQpBICg4GyxtBeEw7hxRk9Buz3qLvN8UmI-nJFCo1JpdPpnKZzE07Oi4QiPMj-KjYRijGScclRIwCRjiRjrcVSuUiVUdbSGtANHyBULsJ0JY9nrK+ABmRV2lUA9UgzXgnWQ-UW8LGpG+M2gIJpy3WxK21Lu8JOuEuikl0DUr11H2p-2CtlWHTB5hAA
π» Code
π Actual behavior
See playground; it can't infer types properly.
π Expected behavior
All have the same type
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: