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
Type 'A' is not assignable to type 'B'.
Types of property 'username' are incompatible.
Type '{ username: string; } | null' is not assignable to type '{ username: string; }'.
Type 'null' is not assignable to type '{ username: string; }'.
π Expected behavior
I know why this error message is shown up but I wonder, wouldn't it be better that the type should be recasted after the if statement? Down the lines username object cannot be null. indeed the function stops if the object is null
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
"recast", "type recast", "2322"
π Version & Regression Information
Version 5.5.4
β― Playground Link
https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgILIN4Chm+QVwGdoQ4BbCALkxzzqJPKuULClAHMBuW3AX2QAfZCHwAbMTz5YsoSLEQoAQjXrEopCtWx01jLSzacedadKwx8IBGGAB7EMkisAFAEpVeBA9bI41dABeT10CdU1mHVDdBg0magAiZzAE3l1pUxk6YBhkFzgAOliI5ECykXExDygIMHwNHjSxWuQAI2oVYLgTLx87ZoKxOw4XVrcsaWT3LiA
π» Code
π Actual behavior
Type 'A' is not assignable to type 'B'.
Types of property 'username' are incompatible.
Type '{ username: string; } | null' is not assignable to type '{ username: string; }'.
Type 'null' is not assignable to type '{ username: string; }'.
π Expected behavior
I know why this error message is shown up but I wonder, wouldn't it be better that the type should be recasted after the if statement? Down the lines username object cannot be null. indeed the function stops if the object is null
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: