-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
feat(runtime-core): add ComponentCustomProperties interface #982
Conversation
There seems to be an unrelated test failing (I only changed typings) |
Ugh, why does GitHub forget the preference and reverted back to normal merge? This has happened a few times lately. |
I manually squashed and force pushed ¯_(ツ)_/¯ |
Why not on the d.ts use it ? (为什么不能在d.ts 中设置这个?) declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$router: Router
}
} |
I also want to known why I can not place the code in the shims-vue.d.ts. I had tried to place the code in shims-vue.d.ts, and i got another errors. |
you have to put the new declaration in the |
Export an interface to allow typing for TS and JS users (free autocompletion) to custom added properties.
Here is an example of adding a property
$router
to every component instance: