feat(types): adjust type exports for manual render function and tooling usage

- v-model and v-show directives are now exposed as public
- compiler-used runtime helpers are now exposed for TS tooling, but marked as @private

close #1329
This commit is contained in:
Evan You
2020-06-10 14:57:21 -04:00
parent 9b5d13e598
commit e4dc03a8b1
13 changed files with 40 additions and 45 deletions

View File

@@ -12,12 +12,18 @@ import { warn } from '../warning'
const COMPONENTS = 'components'
const DIRECTIVES = 'directives'
/**
* @private
*/
export function resolveComponent(name: string): Component | string | undefined {
return resolveAsset(COMPONENTS, name) || name
}
export const NULL_DYNAMIC_COMPONENT = Symbol()
/**
* @private
*/
export function resolveDynamicComponent(
component: unknown
): Component | string | typeof NULL_DYNAMIC_COMPONENT {
@@ -29,11 +35,17 @@ export function resolveDynamicComponent(
}
}
/**
* @private
*/
export function resolveDirective(name: string): Directive | undefined {
return resolveAsset(DIRECTIVES, name)
}
// overload 1: components
/**
* @private
* overload 1: components
*/
function resolveAsset(
type: typeof COMPONENTS,
name: string,
@@ -44,7 +56,7 @@ function resolveAsset(
type: typeof DIRECTIVES,
name: string
): Directive | undefined
// implementation
function resolveAsset(
type: typeof COMPONENTS | typeof DIRECTIVES,
name: string,