forked from vuejs/vue-class-component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
22 lines (18 loc) · 789 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Vue, { ComponentOptions } from 'vue'
import { VueClass } from './declarations'
import { componentFactory, $internalHooks } from './component'
export { createDecorator, VueDecorator, mixins } from './util'
function Component <V extends Vue>(options: ComponentOptions<V> & ThisType<V>): <VC extends VueClass<V>>(target: VC) => VC
function Component <VC extends VueClass<Vue>>(target: VC): VC
function Component (options: ComponentOptions<Vue> | VueClass<Vue>): any {
if (typeof options === 'function') {
return componentFactory(options)
}
return function (Component: VueClass<Vue>) {
return componentFactory(Component, options)
}
}
Component.registerHooks = function registerHooks (keys: string[]): void {
$internalHooks.push(...keys)
}
export default Component