Skip to content

Commit 8839fdc

Browse files
authored
feat(message): add Message component type definition and update the type annotation of the installation method (#3252)
1 parent 5a670fb commit 8839fdc

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/vue/src/message/index.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,27 @@ import Modal from '@opentiny/vue-modal'
22
import { extend } from '@opentiny/utils'
33
import { $prefix } from '@opentiny/vue-common'
44
import { version } from './package.json'
5+
import type { ComponentPublicInstance } from '@opentiny/vue-common'
6+
7+
// 定义 Message 组件类型
8+
interface MessageComponent extends ComponentPublicInstance {
9+
name: string
10+
version: string
11+
install: (Vue: any) => void
12+
componentName: string
13+
}
14+
15+
// 定义 Vue 类型
16+
interface VueConstructor {
17+
component: (name: string, component: any) => void
18+
}
519

620
const Message = extend(true, { props: { componentName: { type: String, default: 'Message' } } }, Modal, {
721
name: $prefix + 'Message'
8-
})
22+
}) as MessageComponent
923

1024
/* istanbul ignore next */
11-
Message.install = function (Vue) {
25+
Message.install = function (Vue: VueConstructor) {
1226
Vue.component(Message.name, Message)
1327
}
1428

0 commit comments

Comments
 (0)