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
{{ message }}
Repository navigation
type checking after instainceOf condition is working incorrectly #5522
I maybe wrong, but I don't think the type narrowing will work on complex types like that, I would suspect because it would over complicate what the compiler would have to keep track of, duplicating the complex type and then narrowing the one element of the type... In order to get it to work, you should try something like:
Kitson Kelly (@kitsonk) , thank you for your answer!
I agree that, this checking is more harder, but i think it's more usefull for developers.
In your solution you added const value only for force compiler to check. I think it's not good idea
Activity
kitsonk commentedon Nov 4, 2015
I maybe wrong, but I don't think the type narrowing will work on complex types like that, I would suspect because it would over complicate what the compiler would have to keep track of, duplicating the complex type and then narrowing the one element of the type... In order to get it to work, you should try something like:
stepancar commentedon Nov 4, 2015
Kitson Kelly (@kitsonk) , thank you for your answer!
I agree that, this checking is more harder, but i think it's more usefull for developers.
In your solution you added const value only for force compiler to check. I think it's not good idea
mhegazy commentedon Nov 4, 2015
looks like a duplicate of #4297