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: improvement createHook type #12766

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhangenming
Copy link
Contributor

No description provided.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 38 kB 34.2 kB
vue.global.prod.js 158 kB 57.8 kB 51.4 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB 18.2 kB 16.6 kB
createApp 54.3 kB 21.2 kB 19.3 kB
createSSRApp 58.5 kB 22.9 kB 20.9 kB
defineCustomElement 59.2 kB 22.8 kB 20.7 kB
overall 68.4 kB 26.3 kB 24 kB

Copy link

pkg-pr-new bot commented Jan 22, 2025

Open in Stackblitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@12766

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@12766

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@12766

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@12766

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@12766

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@12766

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@12766

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@12766

@vue/shared

npm i https://pkg.pr.new/@vue/shared@12766

vue

npm i https://pkg.pr.new/vue@12766

@vue/compat

npm i https://pkg.pr.new/@vue/compat@12766

commit: 2c94650

<T extends Function = () => any>(lifecycle: LifecycleHooks) =>
<T extends Function = () => void>(lifecycle: LifecycleHooks) =>
Copy link
Member

Choose a reason for hiding this comment

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

This change will break the following case:

onMounted(() => {
  return 1
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fix appears to be specifically suited for detecting this particular error pattern.

@@ -77,7 +77,7 @@ const createHook =
injectHook(lifecycle, (...args: unknown[]) => hook(...args), target)
}
}
type CreateHook<T = any> = (
type CreateHook<T = () => void> = (
Copy link
Member

Choose a reason for hiding this comment

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

should be () => any

@edison1105 edison1105 added scope: types 🧹 p1-chore Priority 1: this doesn't change code behavior. wait changes labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 p1-chore Priority 1: this doesn't change code behavior. scope: types wait changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants