Skip to content

Commit 3786c53

Browse files
committed
use default import for Vue
1 parent 2dccbc3 commit 3786c53

File tree

8 files changed

+18
-16
lines changed

8 files changed

+18
-16
lines changed

src/component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as Vue from 'vue'
1+
import Vue, { ComponentOptions } from 'vue'
22
import { VueClass } from './declarations'
33
import { collectDataFromConstructor } from './data'
44

@@ -20,11 +20,11 @@ export const $internalHooks = [
2020
// Property, method and parameter decorators created by `createDecorator` helper
2121
// will enqueue functions that update component options for lazy processing.
2222
// They will be executed just before creating component constructor.
23-
export let $decoratorQueue: ((options: Vue.ComponentOptions<Vue>) => void)[] = []
23+
export let $decoratorQueue: ((options: ComponentOptions<Vue>) => void)[] = []
2424

2525
export function componentFactory (
2626
Component: VueClass,
27-
options: Vue.ComponentOptions<any> = {}
27+
options: ComponentOptions<any> = {}
2828
): VueClass {
2929
options.name = options.name || (Component as any)._componentTag
3030
// prototype props.

src/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as Vue from 'vue'
1+
import Vue from 'vue'
22
import { VueClass } from './declarations'
33
import { noop, warn } from './util'
44

src/declarations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import * as Vue from 'vue'
1+
import Vue from 'vue'
22

33
export type VueClass = { new (): Vue } & typeof Vue

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import * as Vue from 'vue'
1+
import Vue, { ComponentOptions } from 'vue'
22
import { VueClass } from './declarations'
33
import { componentFactory, $internalHooks } from './component'
44

55
export { createDecorator } from './util'
66

7-
function Component <U extends Vue>(options: Vue.ComponentOptions<U>): <V extends VueClass>(target: V) => V
7+
function Component <U extends Vue>(options: ComponentOptions<U>): <V extends VueClass>(target: V) => V
88
function Component <V extends VueClass>(target: V): V
99
function Component <V extends VueClass, U extends Vue>(
10-
options: Vue.ComponentOptions<U> | V
10+
options: ComponentOptions<U> | V
1111
): any {
1212
if (typeof options === 'function') {
1313
return componentFactory(options)
@@ -23,4 +23,4 @@ namespace Component {
2323
}
2424
}
2525

26-
export default Component
26+
export default Component

src/util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import * as Vue from 'vue'
1+
import Vue, { ComponentOptions } from 'vue'
22
import { $decoratorQueue } from './component'
33

44
export const noop = () => {}
55

66
export function createDecorator (
7-
factory: (options: Vue.ComponentOptions<Vue>, key: string) => void
7+
factory: (options: ComponentOptions<Vue>, key: string) => void
88
): (target: Vue, key: string) => void
99
export function createDecorator (
10-
factory: (options: Vue.ComponentOptions<Vue>, key: string, index: number) => void
10+
factory: (options: ComponentOptions<Vue>, key: string, index: number) => void
1111
): (target: Vue, key: string, index: number) => void
1212
export function createDecorator (
13-
factory: (options: Vue.ComponentOptions<Vue>, key: string, index: number) => void
13+
factory: (options: ComponentOptions<Vue>, key: string, index: number) => void
1414
): (target: Vue, key: string, index: any) => void {
1515
return (_, key, index) => {
1616
if (typeof index !== 'number') {

test/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Component, { createDecorator } from '../'
22
import { expect } from 'chai'
3-
import * as Vue from 'vue'
3+
import Vue from 'vue'
44

55
describe('vue-class-component', () => {
66

test/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"noImplicitThis": true,
1414
"strictNullChecks": true,
1515
"removeComments": true,
16-
"suppressImplicitAnyIndexErrors": true
16+
"suppressImplicitAnyIndexErrors": true,
17+
"allowSyntheticDefaultImports": true
1718
},
1819
"include": [
1920
"./**/*.ts"

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"noImplicitThis": true,
1616
"strictNullChecks": true,
1717
"removeComments": true,
18-
"suppressImplicitAnyIndexErrors": true
18+
"suppressImplicitAnyIndexErrors": true,
19+
"allowSyntheticDefaultImports": true
1920
},
2021
"include": [
2122
"src/**/*.ts"

0 commit comments

Comments
 (0)