Skip to content

Commit

Permalink
refactor(components): [image-viewer] simplify emits type checking (#8329
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ryuhangyeong committed Jun 17, 2022
1 parent ca4d4ff commit cf93395
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/components/image-viewer/src/image-viewer.ts
@@ -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 =
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit cf93395

Please sign in to comment.