Skip to content

Commit 5b5a88f

Browse files
committed
refactor TypeScript typings to use ES style exports
1 parent 00648f0 commit 5b5a88f

File tree

5 files changed

+34
-36
lines changed

5 files changed

+34
-36
lines changed

types/index.d.ts

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
import * as V from "./vue";
2-
import * as Options from "./options";
3-
import * as Plugin from "./plugin";
4-
import * as VNode from "./vnode";
1+
import { Vue } from "./vue";
52

6-
// `Vue` in `export = Vue` must be a namespace
7-
// All available types are exported via this namespace
8-
declare namespace Vue {
9-
export type CreateElement = V.CreateElement;
3+
export default Vue;
104

11-
export type Component = Options.Component;
12-
export type AsyncComponent = Options.AsyncComponent;
13-
export type ComponentOptions<V extends Vue> = Options.ComponentOptions<V>;
14-
export type FunctionalComponentOptions = Options.FunctionalComponentOptions;
15-
export type RenderContext = Options.RenderContext;
16-
export type PropOptions = Options.PropOptions;
17-
export type ComputedOptions<V extends Vue> = Options.ComputedOptions<V>;
18-
export type WatchHandler<V extends Vue> = Options.WatchHandler<V, any>;
19-
export type WatchOptions = Options.WatchOptions;
20-
export type DirectiveFunction = Options.DirectiveFunction;
21-
export type DirectiveOptions = Options.DirectiveOptions;
5+
export {
6+
CreateElement
7+
} from "./vue";
228

23-
export type PluginFunction<T> = Plugin.PluginFunction<T>;
24-
export type PluginObject<T> = Plugin.PluginObject<T>;
9+
export {
10+
Component,
11+
AsyncComponent,
12+
ComponentOptions,
13+
FunctionalComponentOptions,
14+
RenderContext,
15+
PropOptions,
16+
ComputedOptions,
17+
WatchHandler,
18+
WatchOptions,
19+
DirectiveFunction,
20+
DirectiveOptions
21+
} from "./options";
2522

26-
export type VNodeChildren = VNode.VNodeChildren;
27-
export type VNodeChildrenArrayContents = VNode.VNodeChildrenArrayContents;
28-
export type VNode = VNode.VNode;
29-
export type VNodeComponentOptions = VNode.VNodeComponentOptions;
30-
export type VNodeData = VNode.VNodeData;
31-
export type VNodeDirective = VNode.VNodeDirective;
32-
}
23+
export {
24+
PluginFunction,
25+
PluginObject
26+
} from "./plugin";
3327

34-
// TS cannot merge imported class with namespace, declare a subclass to bypass
35-
declare class Vue extends V.Vue {}
36-
37-
export = Vue;
28+
export {
29+
VNodeChildren,
30+
VNodeChildrenArrayContents,
31+
VNode,
32+
VNodeComponentOptions,
33+
VNodeData,
34+
VNodeDirective
35+
} from "./vnode";

types/test/augmentation-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue = require("../index");
1+
import Vue from "../index";
22

33
declare module "../vue" {
44
// add instance property and method

types/test/options-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue = require("../index");
1+
import Vue from "../index";
22
import { ComponentOptions, FunctionalComponentOptions } from "../index";
33

44
interface Component extends Vue {

types/test/plugin-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue = require("../index");
1+
import Vue from "../index";
22
import { PluginFunction, PluginObject } from "../index";
33

44
class Option {

types/test/vue-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue = require("../index");
1+
import Vue from "../index";
22

33
class Test extends Vue {
44
a: number;

0 commit comments

Comments
 (0)