New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type guard on <template> for a named slot is not recognized #625
Comments
Thanks for the report, this is a similar problem to vuejs/core#3498. |
This seems been fixed in 0.34.9 (or earlier), but come back again in 0.34.12 |
@NateScarlet we have never fix this. 😅 I guess your case it is a side effect by fixed #1264. |
@johnsoncodehk Can/will this be fixed? Can you make a "special case" fix for this as suggested here: vuejs/core#3498 (comment) |
We can't because the situation is much more complicated. |
We refactored the template codegen and now find a simple workaround. |
When a type guard is used on a
<template>
for a named slot (also the default slot), then it is not recognized in the slot content.A simple example:
This example assumes that
MyComponent
exists and behaves differently depending on if the default slot is available or not. Because of this thev-if
can't be moved anywhere else.TypeScript complains though that
status
in{{ status.message }}
can beundefined
. Duplicating the template element without#default
solves the issue but looks odd in the template and serves no other pupose.The text was updated successfully, but these errors were encountered: