Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose all types via index.d.ts #3608

Merged
merged 2 commits into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 28 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
import {Vue as _Vue} from "./vue";
import * as Options from "./options";
import * as Plugin from "./plugin";
import * as VNode from "./vnode";

// `Vue` in `export = Vue` must be a namespace
declare namespace Vue {}
// All available types are exported via this namespace
declare namespace Vue {
export type ComponentOptions = Options.ComponentOptions;
export type FunctionalComponentOptions = Options.FunctionalComponentOptions;
export type RenderContext = Options.RenderContext;
export type PropOptions = Options.PropOptions;
export type ComputedOptions = Options.ComputedOptions;
export type WatchHandler = Options.WatchHandler;
export type WatchOptions = Options.WatchOptions;
export type DirectiveFunction = Options.DirectiveFunction;
export type DirectiveOptions = Options.DirectiveOptions;

export type PluginFunction<T> = Plugin.PluginFunction<T>;
export type PluginObject<T> = Plugin.PluginObject<T>;

export type VNodeChildren = VNode.VNodeChildren;
export type VNodeChildrenArrayContents = VNode.VNodeChildrenArrayContents;
export type VNode = VNode.VNode;
export type VNodeComponentOptions = VNode.VNodeComponentOptions;
export type VNodeData = VNode.VNodeData;
export type VNodeDirective = VNode.VNodeDirective;
}

// TS cannot merge imported class with namespace, declare a subclass to bypass
declare class Vue extends _Vue {}

export = Vue;
2 changes: 1 addition & 1 deletion types/test/options-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue = require("../index");
import { ComponentOptions, FunctionalComponentOptions } from "../options";
import { ComponentOptions, FunctionalComponentOptions } from "../index";

interface Component extends Vue {
a: number;
Expand Down
2 changes: 1 addition & 1 deletion types/test/plugin-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue = require("../index");
import { PluginFunction, PluginObject } from "../plugin";
import { PluginFunction, PluginObject } from "../index";

class Option {
prefix: string;
Expand Down