|
1 | | -import { type DefineComponent, type App, type VNode, h, render } from 'vue' |
| 1 | +import { type App, type VNode, h, render } from 'vue' |
2 | 2 | import { defu } from 'defu' |
3 | 3 |
|
4 | | -import type { NinjaToasterTheme, NinjaToasterBaseProps, NinjaToasterProps, NinjaToasterShow } from '../types' |
| 4 | +import type { NinjaToasterTheme, NinjaToasterBaseProps, NinjaToasterProps, NinjaToasterShow, NinjaToasterInstance, ComponentProps } from '../types' |
5 | 5 | import type { NinjaToasterRenderQueue } from './queue' |
6 | 6 | import { type NinjaToastEventBus, createEventBus } from './events' |
7 | 7 | import NinjaToaster from './components/NinjaToaster' |
8 | 8 |
|
9 | 9 | import { resolveComponent, useAppConfig, useNuxtApp } from '#imports' |
10 | | -import type * as _AllComponents from '#components' |
11 | | - |
12 | | -type DefaultProps = InstanceType<DefineComponent>['$props'] |
13 | | - |
14 | | -type ComponentProps<T> = T extends keyof typeof _AllComponents |
15 | | - ? Omit<InstanceType<(typeof _AllComponents)[T]>['$props'], keyof DefaultProps> |
16 | | - : undefined |
17 | 10 |
|
18 | 11 | function createElement() { |
19 | | - // @ts-ignore |
20 | 12 | if (process.server) { |
21 | 13 | return null |
22 | 14 | } |
@@ -56,11 +48,11 @@ function ensureClassesArray(theme?: NinjaToasterTheme) { |
56 | 48 |
|
57 | 49 | export function createNinjaToaster( |
58 | 50 | createProps: Omit<NinjaToasterProps, 'content'> = {} |
59 | | -) { |
| 51 | +): NinjaToasterInstance { |
60 | 52 | const events = createEventBus() |
61 | 53 | const queues: Map<string, NinjaToasterRenderQueue> = new Map() |
62 | 54 |
|
63 | | - function showComponent<T extends keyof typeof _AllComponents>(name: T, { |
| 55 | + function showComponent<T extends keyof typeof import('#components')>(name: T, { |
64 | 56 | props, |
65 | 57 | children, |
66 | 58 | options, |
@@ -110,7 +102,6 @@ export function createNinjaToaster( |
110 | 102 | } |
111 | 103 | }) |
112 | 104 |
|
113 | | - // @ts-ignore |
114 | 105 | if (process.server) { |
115 | 106 | resolve({ |
116 | 107 | el: null, |
|
0 commit comments