refactor(components): [image-viewer] simplify emits type checking (#8329)

This commit is contained in:
류한경 2022-06-17 22:37:30 +09:00 committed by GitHub
parent ca4d4ffcac
commit cf9339567b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,9 @@
import { buildProps, definePropType, mutable } from '@element-plus/utils'
import {
buildProps,
definePropType,
isNumber,
mutable,
} from '@element-plus/utils'
import type { Component, ExtractPropTypes } from 'vue'
export type ImageViewerAction =
@ -40,7 +45,7 @@ export type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>
export const imageViewerEmits = {
close: () => true,
switch: (index: number) => typeof index === 'number',
switch: (index: number) => isNumber(index),
}
export type ImageViewerEmits = typeof imageViewerEmits