Closed
Description
With options API, I used to inject "global" variables into the render context with:
Vue.mixin({
computed: {
$store: () => store,
},
})
declare module 'vue/types/vue' {
interface Vue {
$store: Store
}
}
and then refer to it with:
<template>
<div>store = {{ $store }}</div>
</template>
How would I do the same with composition API? node_modules/@vue/composition-api/dist/component/component.d.ts
seems to be exporting a non-augmentable type ComponentRenderProxy
with hardcoded set of properties:
export declare type ComponentRenderProxy<P = {}, S = {}, PublicProps = P> = {
$data: S;
$props: PublicProps;
$attrs: Data;
$refs: Data;
$slots: Data;
$root: ComponentInstance | null;
$parent: ComponentInstance | null;
$emit: (event: string, ...args: unknown[]) => void;
} & P & S;
so the template fails to validate:
Any ideas?
Also (I'm sure I'm missing something!) why doesn't ComponentRenderProxy
simply extend Vue
?
Metadata
Metadata
Assignees
Labels
No labels