Skip to content

Commit 2deb954

Browse files
authored
chore: refactor mount types (#1776)
1 parent 43bc117 commit 2deb954

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/mount.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ import { trackInstance } from './utils/autoUnmount'
4545
import { createVueWrapper } from './wrapperFactory'
4646

4747
// NOTE this should come from `vue`
48-
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps
49-
5048
const MOUNT_OPTIONS: Array<keyof MountingOptions<any>> = [
5149
'attachTo',
5250
'attrs',
@@ -57,24 +55,6 @@ const MOUNT_OPTIONS: Array<keyof MountingOptions<any>> = [
5755
'shallow'
5856
]
5957

60-
type ComponentMountingOptions<T> = T extends DefineComponent<
61-
infer PropsOrPropOptions,
62-
any,
63-
infer D,
64-
any,
65-
any
66-
>
67-
? MountingOptions<
68-
Partial<ExtractDefaultPropTypes<PropsOrPropOptions>> &
69-
Omit<
70-
Readonly<ExtractPropTypes<PropsOrPropOptions>> & PublicProps,
71-
keyof ExtractDefaultPropTypes<PropsOrPropOptions>
72-
>,
73-
D
74-
> &
75-
Record<string, any>
76-
: MountingOptions<any>
77-
7858
function getInstanceOptions(
7959
options: MountingOptions<any> & Record<string, any>
8060
): Record<string, any> {
@@ -94,6 +74,26 @@ function getInstanceOptions(
9474
return resultOptions
9575
}
9676

77+
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps
78+
79+
type ComponentMountingOptions<T> = T extends DefineComponent<
80+
infer PropsOrPropOptions,
81+
any,
82+
infer D,
83+
any,
84+
any
85+
>
86+
? MountingOptions<
87+
Partial<ExtractDefaultPropTypes<PropsOrPropOptions>> &
88+
Omit<
89+
Readonly<ExtractPropTypes<PropsOrPropOptions>> & PublicProps,
90+
keyof ExtractDefaultPropTypes<PropsOrPropOptions>
91+
>,
92+
D
93+
> &
94+
Record<string, any>
95+
: MountingOptions<any>
96+
9797
// Class component (without vue-class-component) - no props
9898
export function mount<V extends {}>(
9999
originalComponent: {

0 commit comments

Comments
 (0)