types: trim exports

This commit is contained in:
Evan You 2018-10-04 18:12:18 -04:00
parent bb2da9633e
commit ba918b5afe
4 changed files with 14 additions and 17 deletions

View File

@ -15,13 +15,13 @@ export { createComponentInstance } from './componentUtils'
// Optional APIs
// these are imported on-demand and can be tree-shaken
export * from './optional/directive'
export * from './optional/context'
export * from './optional/asyncComponent'
export * from './optional/keepAlive'
export { applyDirective } from './optional/directive'
export { Provide, Inject } from './optional/context'
export { createAsyncComponent } from './optional/asyncComponent'
export { KeepAlive } from './optional/keepAlive'
// flags & types
export { ComponentType, ComponentClass, FunctionalComponent } from './component'
export { ComponentOptions, PropType } from './componentOptions'
export { VNodeFlags, ChildrenFlags } from './flags'
export { VNode, VNodeData, VNodeChildren, Key, Ref, Slots, Slot } from './vdom'
export { VNode, Slots } from './vdom'

View File

@ -3,12 +3,12 @@ import { createComponentVNode, Slots } from '../vdom'
import { Component, ComponentType, ComponentClass } from '../component'
import { unwrap } from '@vue/observer'
export interface AsyncComponentFactory {
interface AsyncComponentFactory {
(): Promise<ComponentType>
resolved?: ComponentType
}
export interface AsyncComponentFullOptions {
interface AsyncComponentFullOptions {
factory: AsyncComponentFactory
loading?: ComponentType
error?: ComponentType
@ -16,9 +16,7 @@ export interface AsyncComponentFullOptions {
timeout?: number
}
export type AsyncComponentOptions =
| AsyncComponentFactory
| AsyncComponentFullOptions
type AsyncComponentOptions = AsyncComponentFactory | AsyncComponentFullOptions
interface AsyncContainerData {
comp: ComponentType | null

View File

@ -1,6 +1,5 @@
import { observable } from '@vue/observer'
import { Component } from '../component'
import { Slots } from '../vdom'
const contextStore = observable() as Record<string | symbol, any>
@ -39,7 +38,7 @@ export class Provide extends Component<{}, ProviderProps> {
beforeUpdate() {
this.updateValue()
}
render(props: ProviderProps, slots: Slots) {
render(props: any, slots: any) {
return slots.default && slots.default()
}
}
@ -57,7 +56,7 @@ Provide.options = {
}
export class Inject extends Component {
render(props: any, slots: Slots) {
render(props: any, slots: any) {
return slots.default && slots.default(contextStore[props.id])
}
}

View File

@ -1,7 +1,7 @@
import { VNode } from '../vdom'
import { MountedComponent } from '../component'
export interface DirectiveBinding {
interface DirectiveBinding {
instance: MountedComponent
value?: any
oldValue?: any
@ -9,14 +9,14 @@ export interface DirectiveBinding {
modifiers?: DirectiveModifiers
}
export type DirectiveHook = (
type DirectiveHook = (
el: any,
binding: DirectiveBinding,
vnode: VNode,
prevVNode: VNode | void
) => void
export interface Directive {
interface Directive {
beforeMount: DirectiveHook
mounted: DirectiveHook
beforeUpdate: DirectiveHook
@ -25,7 +25,7 @@ export interface Directive {
unmounted: DirectiveHook
}
export type DirectiveModifiers = Record<string, boolean>
type DirectiveModifiers = Record<string, boolean>
const valueCache = new WeakMap<Directive, WeakMap<any, any>>()