diff --git a/types/index.d.ts b/types/index.d.ts index b0e24d767e9..58ceb209e5d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,9 +1,8 @@ import { Vue } from "./vue"; +import "./umd"; export default Vue; -export as namespace Vue; - export { CreateElement, VueConstructor diff --git a/types/test/tsconfig.json b/types/test/tsconfig.json index b816ce07cdc..dab30a608bf 100644 --- a/types/test/tsconfig.json +++ b/types/test/tsconfig.json @@ -14,17 +14,9 @@ "vue": ["../index.d.ts"] } }, - "files": [ - "../index.d.ts", - "../options.d.ts", - "../plugin.d.ts", - "../vnode.d.ts", - "../vue.d.ts", - "options-test.ts", - "plugin-test.ts", - "vue-test.ts", - "augmentation-test.ts", - "ssr-test.ts" + "include": [ + "../*.d.ts", + "*.ts" ], "compileOnSave": false } diff --git a/types/test/umd-test.ts b/types/test/umd-test.ts new file mode 100644 index 00000000000..ffdc7046f92 --- /dev/null +++ b/types/test/umd-test.ts @@ -0,0 +1,7 @@ +const vm = new Vue({ + template: "
hi
" +}); + +const options: Vue.ComponentOptions = { + template: "
test
" +}; diff --git a/types/umd.d.ts b/types/umd.d.ts new file mode 100644 index 00000000000..618d484e48d --- /dev/null +++ b/types/umd.d.ts @@ -0,0 +1,48 @@ +import * as V from "./index"; +import { + DefaultData, + DefaultProps, + DefaultMethods, + DefaultComputed, + PropsDefinition +} from "./options"; + +// Expose some types for backword compatibility... +declare namespace Vue { + // vue.d.ts + export type CreateElement = V.CreateElement; + export type VueConstructor = V.VueConstructor; + + // options.d.ts + export type Component, Methods=DefaultMethods, Computed=DefaultComputed, Props=DefaultProps> = V.Component; + export type AsyncComponent, Methods=DefaultMethods, Computed=DefaultComputed, Props=DefaultProps> = V.AsyncComponent; + export type ComponentOptions, Methods=DefaultMethods, Computed=DefaultComputed, PropsDef=PropsDefinition, Props=DefaultProps> = V.ComponentOptions; + export type FunctionalComponentOptions> = V.FunctionalComponentOptions; + export type RenderContext = V.RenderContext; + export type PropType = V.PropType; + export type PropOptions = V.PropOptions; + export type ComputedOptions = V.ComputedOptions; + export type WatchHandler = V.WatchHandler; + export type WatchOptions = V.WatchOptions; + export type WatchOptionsWithHandler = V.WatchOptionsWithHandler; + export type DirectiveFunction = V.DirectiveFunction; + export type DirectiveOptions = V.DirectiveOptions; + + // plugin.d.ts + export type PluginFunction = V.PluginFunction; + export type PluginObject = V.PluginObject; + + // vnode.d.ts + export type VNodeChildren = V.VNodeChildren; + export type VNodeChildrenArrayContents = V.VNodeChildrenArrayContents; + export type VNode = V.VNode; + export type VNodeComponentOptions = V.VNodeComponentOptions; + export type VNodeData = V.VNodeData; + export type VNodeDirective = V.VNodeDirective; +} + +declare class Vue extends V.default {} + +export = Vue; + +export as namespace Vue;