fix(test-utils): fix type error (#8780)

* fix(test-utils): fix type error

* chore: update

* chore: update
This commit is contained in:
zz 2022-07-16 21:01:48 +08:00 committed by GitHub
parent 4b0b051c53
commit d45c2b95b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,3 @@
// @ts-nocheck
import { mount } from '@vue/test-utils'
import { merge } from 'lodash'
@ -9,14 +8,16 @@ const makeMount = <C, O, E>(element: C, defaultOptions: O) => {
interface Options {
data?: () => {
[key: string]: any
[key: string]: unknown
}
methods?: {
[key: string]: (...args) => any
[key: string]: (...args: unknown[]) => any
}
}
export const makeMountFunc = (defaultOptions) => {
export const makeMountFunc = <T extends Record<string, unknown>>(
defaultOptions: T
) => {
return (template: string, options: Options) => {
return mount({
...merge({}, defaultOptions, options),

View File

@ -1,4 +1,3 @@
// @ts-nocheck
import { nextTick } from 'vue'
import { afterAll, beforeAll } from 'vitest'
@ -20,6 +19,6 @@ export function mockImageEvent() {
})
})
afterAll(() => {
Object.defineProperty(imageProto, 'src', oldDescriptor)
Object.defineProperty(imageProto, 'src', oldDescriptor!)
})
}