Skip to content
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

fix: fixes object literal parsing for <component :is> #3324

Merged
merged 4 commits into from Jun 26, 2023

Conversation

so1ve
Copy link
Member

@so1ve so1ve commented Jun 25, 2023

fix #3171

so1ve and others added 4 commits June 25, 2023 17:58
refactor

chore: format

refactor

refactor
This reverts commit 02846cc.
fix: types

refactor

chore: format

refactor
@johnsoncodehk johnsoncodehk merged commit 576c252 into vuejs:master Jun 26, 2023
3 checks passed
@johnsoncodehk johnsoncodehk changed the title fix: allow passing inline components or without using defineComponent fix: fixes object literal parsing for <component :is> Jun 26, 2023
@so1ve so1ve deleted the fix/issue-3171 branch June 26, 2023 15:11
@so1ve
Copy link
Member Author

so1ve commented Jun 26, 2023

@johnsoncodehk I think we should allow passing inline components since they just work well :( We should not pass an extra render prop to the component tag because it doesn't take effect and should be considered a bug.

@so1ve so1ve restored the fix/issue-3171 branch June 26, 2023 15:15
@so1ve so1ve deleted the fix/issue-3171 branch June 26, 2023 15:15
@johnsoncodehk
Copy link
Member

We need to avoid introducing additional conventions (__isFragment, __isTeleport, __isSuspense etc).
Perhaps we could append as any to ignore the type when the :is expression is an object literal.

@so1ve
Copy link
Member Author

so1ve commented Jun 26, 2023

However, if we do so, type-checking will be disabled. I think my approach is fine, just need a new way to detect whether the argument is defined by using defineComponent.

@johnsoncodehk
Copy link
Member

It cannot be perfectly supported, and if we decide to support object literals, we should also handle edge cases like :is="condition ? { render } : { props }".

Is your use case specific to the render option? If so, you can replace :is="{ render: eventSummary }" with :is="eventSummary", since functional component is a valid type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"TS1005: ',' expected" in component :is object literal
2 participants