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 // Optional APIs
// these are imported on-demand and can be tree-shaken // these are imported on-demand and can be tree-shaken
export * from './optional/directive' export { applyDirective } from './optional/directive'
export * from './optional/context' export { Provide, Inject } from './optional/context'
export * from './optional/asyncComponent' export { createAsyncComponent } from './optional/asyncComponent'
export * from './optional/keepAlive' export { KeepAlive } from './optional/keepAlive'
// flags & types // flags & types
export { ComponentType, ComponentClass, FunctionalComponent } from './component' export { ComponentType, ComponentClass, FunctionalComponent } from './component'
export { ComponentOptions, PropType } from './componentOptions' export { ComponentOptions, PropType } from './componentOptions'
export { VNodeFlags, ChildrenFlags } from './flags' 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 { Component, ComponentType, ComponentClass } from '../component'
import { unwrap } from '@vue/observer' import { unwrap } from '@vue/observer'
export interface AsyncComponentFactory { interface AsyncComponentFactory {
(): Promise<ComponentType> (): Promise<ComponentType>
resolved?: ComponentType resolved?: ComponentType
} }
export interface AsyncComponentFullOptions { interface AsyncComponentFullOptions {
factory: AsyncComponentFactory factory: AsyncComponentFactory
loading?: ComponentType loading?: ComponentType
error?: ComponentType error?: ComponentType
@ -16,9 +16,7 @@ export interface AsyncComponentFullOptions {
timeout?: number timeout?: number
} }
export type AsyncComponentOptions = type AsyncComponentOptions = AsyncComponentFactory | AsyncComponentFullOptions
| AsyncComponentFactory
| AsyncComponentFullOptions
interface AsyncContainerData { interface AsyncContainerData {
comp: ComponentType | null comp: ComponentType | null

View File

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

View File

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