Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

chore(bridge): Improve typing for vueApp #1996

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions packages/bridge/src/runtime/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { Hookable } from 'hookable'
// @ts-ignore
import type { Vue } from 'vue/types/vue'
import type { ComponentOptions } from 'vue'
import type { Vue, VueConstructor, ComponentOptions } from 'vue'
import { defineComponent, getCurrentInstance } from './composables'

export const isVue2 = true
Expand All @@ -11,26 +9,11 @@ export const defineNuxtComponent = defineComponent

export interface RuntimeNuxtHooks { }

export interface VueAppCompat {
component: Vue['component'],
config: {
globalProperties: any
[key: string]: any
},
directive: Vue['directive'],
mixin: Vue['mixin'],
mount: Vue['mount'],
provide: (name: string, value: any) => void,
unmount: Vue['unmount'],
use: Vue['use']
version: string
}

export interface NuxtAppCompat {
nuxt2Context: Vue
vue2App: ComponentOptions<Vue>

vueApp: VueAppCompat
vueApp: VueConstructor
Copy link
Member

Choose a reason for hiding this comment

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

vueApp is a vue@3 a partial shim (while VueConstructor imported from vue in Nuxt2/bridge is from Vue2). Maybe we can use VueConstructor and keep VueAppCompat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you maybe clarify the purpose of vueApp in the context of bridge. All plugins and other libraries are based on vue2 anyway. Or is it meant as a migration path to use vue3-based libraries with nuxt/bridge?

Copy link
Member

@pi0 pi0 Nov 18, 2021

Choose a reason for hiding this comment

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

Indeed. it mimic vue3 insterface for integrations with vue3-only libs like @vueuse/head. Otherwise on bridge you should rely on nuxtApp.vue2App if plugin is meant to be used for Vue2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay thanks for the clarification. In this case, this PR doesn't make any sense. Let me see if I find a nice solution for VueAppCompat and I'll open a new PR then.


globalName: string

Expand Down