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
constselectedCollection: Ref<Col1|Col2|null>=ref(null)constselectedCollectionId=computed(()=>selectedCollection.value?.id)constselectedCollectionAccountId=computed(()=>selectedCollection.value?.collaborators.find(col=>col.id==='1'))// throws "This expression is not callable."
For some reason, vue-tsc is not able to remove the undefined type when using the optional chaining. It still thinks that selectedColelction.value can be null, even though the optional chaining should take care of that.
Consider the following code and types:
For some reason, vue-tsc is not able to remove the
undefined
type when using the optional chaining. It still thinks thatselectedColelction.value
can be null, even though the optional chaining should take care of that.As a reference, here's the same implementation in regular TypeScript: https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgMIHsA2cBGBnARmQG8AoZZAfUrAE8AHCEOAWwgC5kAiDTbHdFDhhBXANzlkwACac8YKKADmEgL6lSoSLEQpeuPACYSk6nUbM2nHln6DhoiRRlyFytRq3R4SNFiJkFGYMTKwc3LyYEAhgwOgg4pIuyPKKICqSiAjoAK7gAJKyKW7pyAA+yCA5fE7I2eBCMYWuaUrlldWYtdl8uPYiUHic+vgEANoAuh6kEAAe9IJgUuDeun6YxoFUNCGW4TZ80bHxic5Fqe6ZCNl5YM3Fre1VNZL1Coh35yVtFc9dr7Y+kIBkN1gZDJNpvV5Mg4MN-MgALwmChBHYWMLWSJHOIJAA0kjOnAA5ARiQTUXVAQJgYJQZMKaisrkCkU-oyKG9Gp9OH9SOpSNCljh4RskSjUcEMVYIrYcScOVIiqTyYSqb0aQ5BpwGWrmbd7uy1VyPobOvyNELkDBxQAKHqiogVXjGX6dACUSIAfBLOfE8FgIAA6TDoJT2rAAfiDPTstMGQZgoGkEcw3vVQZkSMRyJV7vd-KAA
The text was updated successfully, but these errors were encountered: