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

types(runtime-core): Add h overload to support string|Component|DefineComponent types #5432

Merged
merged 4 commits into from Oct 23, 2023

Conversation

pikax
Copy link
Member

@pikax pikax commented Feb 15, 2022

fix #5431

@netlify
Copy link

netlify bot commented Feb 15, 2022

✔️ Deploy Preview for vue-next-template-explorer ready!

🔨 Explore the source changes: 1bd5fc0

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-next-template-explorer/deploys/620ba3543acc3d0009d2a576

😎 Browse the preview: https://deploy-preview-5432--vue-next-template-explorer.netlify.app

@netlify
Copy link

netlify bot commented Feb 15, 2022

✔️ Deploy Preview for vuejs-coverage ready!

🔨 Explore the source changes: 1bd5fc0

🔍 Inspect the deploy log: https://app.netlify.com/sites/vuejs-coverage/deploys/620ba3548c854800075fa449

😎 Browse the preview: https://deploy-preview-5432--vuejs-coverage.netlify.app

@netlify
Copy link

netlify bot commented Feb 15, 2022

✔️ Deploy Preview for vue-sfc-playground ready!

🔨 Explore the source changes: 1bd5fc0

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-sfc-playground/deploys/620ba354c2352a0008ca39ed

😎 Browse the preview: https://deploy-preview-5432--vue-sfc-playground.netlify.app/

@@ -149,7 +150,6 @@ describe('h support for generic component type', () => {
function foo(bar: Component) {
h(bar)
h(bar, 'hello')
// @ts-expect-error
h(bar, { id: 'ok' }, 'hello')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After having a thought on this, I don't think having a Prop type check on Component is good, since if the user is using Component interface is because he does not know the type, therefor type checking is not needed here.

If we want type checking having a Prop is recommended

declare function renderMyComp<P>(p: Component<P>, props: P): void
renderMyComp({} as Component<{ a: string }>, { a: '' })

@pikax pikax added 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: types labels Feb 15, 2022
@github-actions
Copy link

github-actions bot commented Oct 6, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB 32.7 kB 29.5 kB
vue.global.prod.js 132 kB 49.4 kB 44.4 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.9 kB 17.2 kB
createSSRApp 50.7 kB 20 kB 18.2 kB
defineCustomElement 50.3 kB 19.7 kB 18 kB
overall 61.3 kB 23.7 kB 21.6 kB

@pikax pikax requested review from sodatea and sxzz October 6, 2023 13:18
@sodatea sodatea added the ready to merge The PR is ready to be merged. label Oct 10, 2023
@yyx990803 yyx990803 merged commit 16ecb44 into vuejs:main Oct 23, 2023
11 checks passed
@pikax pikax deleted the types/h_overload_for_multiple_types branch October 23, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: types
Projects
Development

Successfully merging this pull request may close these issues.

Overloads for render function cause needless check
4 participants