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
asyncfunctionx(){return'hello';}(awaitPromise.allSettled([x()])).filter((s)=>s.status==="fulfilled")// narrows type to PromiseFulfilledResult<string>[].map(({ value })=>value);(awaitPromise.allSettled([x()])).filter(({ status })=>status==="fulfilled")// does not narrow type.map(({ value })=>value);// unsure that value exists
π Actual behavior
π Expected behavior
Expect the destructured version to narrow the element type as well.
Additional information about the issue
I found #28311 when searching for existing bugs, looks like it can be closed by the existing 5.5 features, good work!
The text was updated successfully, but these errors were encountered:
π Search Terms
filter narrow destructuring
π Version & Regression Information
This is recent functionality, in 5.5, I think? (type narrowing via array filter functions).
β― Playground Link
https://www.typescriptlang.org/play/?target=7&jsx=0&ts=5.5.4#code/KYDwDg9gTgLgBAbwL4G4BQaCGBnAngOwGM4AzAVyJgEsJ84QAKASkTTnbimBjKjoHIAFsAA2IiP3RIMDTAHdMVeAAUoEALZVswAHSYxAZW4wRwACYMA2oyYBdJkzZwdJKiJjAoDBthYBeAD44bB1sGEwebDg-GLgAInIRVzFzOMd2HXVMMG8EOAA3fTJgOCR-IMKRYqZ0NFkFJThVDS1dfREjGBNzKxt7dOdkjy8GPLCIsiiy6KDxyOjYhLIkt1MzNKdM7NyCopLpwN2q4BqMM-O0IA
π» Code
π Actual behavior
π Expected behavior
Expect the destructured version to narrow the element type as well.
Additional information about the issue
I found #28311 when searching for existing bugs, looks like it can be closed by the existing 5.5 features, good work!
The text was updated successfully, but these errors were encountered: