-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(types): further improve Vue type declarations for canonical usage (
- Loading branch information
1 parent
64e3943
commit db138e2
Showing
10 changed files
with
394 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
import * as V from "./vue"; | ||
import * as Options from "./options"; | ||
import * as Plugin from "./plugin"; | ||
import * as VNode from "./vnode"; | ||
import { Vue } from "./vue"; | ||
|
||
// `Vue` in `export = Vue` must be a namespace | ||
// All available types are exported via this namespace | ||
declare namespace Vue { | ||
export type CreateElement = V.CreateElement; | ||
export default Vue; | ||
|
||
export type Component = Options.Component; | ||
export type AsyncComponent = Options.AsyncComponent; | ||
export type ComponentOptions<V extends Vue> = Options.ComponentOptions<V>; | ||
export type FunctionalComponentOptions = Options.FunctionalComponentOptions; | ||
export type RenderContext = Options.RenderContext; | ||
export type PropOptions = Options.PropOptions; | ||
export type ComputedOptions<V extends Vue> = Options.ComputedOptions<V>; | ||
export type WatchHandler<V extends Vue> = Options.WatchHandler<V, any>; | ||
export type WatchOptions = Options.WatchOptions; | ||
export type DirectiveFunction = Options.DirectiveFunction; | ||
export type DirectiveOptions = Options.DirectiveOptions; | ||
export { | ||
CreateElement | ||
} from "./vue"; | ||
|
||
export type PluginFunction<T> = Plugin.PluginFunction<T>; | ||
export type PluginObject<T> = Plugin.PluginObject<T>; | ||
export { | ||
Component, | ||
AsyncComponent, | ||
ComponentOptions, | ||
FunctionalComponentOptions, | ||
RenderContext, | ||
PropOptions, | ||
ComputedOptions, | ||
WatchHandler, | ||
WatchOptions, | ||
WatchOptionsWithHandler, | ||
DirectiveFunction, | ||
DirectiveOptions | ||
} from "./options"; | ||
|
||
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; | ||
} | ||
export { | ||
PluginFunction, | ||
PluginObject | ||
} from "./plugin"; | ||
|
||
// TS cannot merge imported class with namespace, declare a subclass to bypass | ||
declare class Vue extends V.Vue {} | ||
|
||
export = Vue; | ||
export { | ||
VNodeChildren, | ||
VNodeChildrenArrayContents, | ||
VNode, | ||
VNodeComponentOptions, | ||
VNodeData, | ||
VNodeDirective | ||
} from "./vnode"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.