Skip to content

Commit

Permalink
refactor(vue): replace inline types with types from core package
Browse files Browse the repository at this point in the history
  • Loading branch information
jrson83 committed Apr 25, 2024
1 parent b8c33cc commit dfef9b3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/vue/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// @ts-nocheck
import {
type HeadManager,
type HeadManagerOnUpdate,
type HeadManagerTitleCallback,
type Page,
type PageProps,
createHeadManager,
type router,
router,
} from '@inertiajs-revamped/core'
import {
type DefineComponent,
Expand All @@ -27,8 +30,8 @@ export interface InertiaAppProps {
resolveComponent?: (
name: string
) => DefineComponent | Promise<DefineComponent>
titleCallback?: (title: string) => string
onHeadUpdate?: (elements: string[]) => void
titleCallback?: HeadManagerTitleCallback
onHeadUpdate?: HeadManagerOnUpdate | null
}

export type InertiaApp = DefineComponent<InertiaAppProps>
Expand All @@ -37,7 +40,8 @@ const component = ref(null)
const page = ref<Page<any>>(null)
const layout = shallowRef(null)
const key = ref(null)
let headManager = null

let headManager: HeadManager | null = null

const App: InertiaApp = defineComponent({
name: 'Inertia',
Expand All @@ -57,12 +61,12 @@ const App: InertiaApp = defineComponent({
required: false,
},
titleCallback: {
type: Function as PropType<(title: string) => string>,
type: Function as PropType<HeadManagerTitleCallback>,
required: false,
default: (title) => title,
default: (title: string) => title,
},
onHeadUpdate: {
type: Function as PropType<(elements: string[]) => void>,
type: Function as PropType<HeadManagerOnUpdate> | null,
required: false,
default: () => () => {},
},
Expand Down

0 comments on commit dfef9b3

Please sign in to comment.