refactor: remove shorthands on h

This commit is contained in:
Evan You 2018-11-13 01:08:22 -05:00
parent ca91797c7f
commit 0cd8183fbf
2 changed files with 9 additions and 17 deletions

View File

@ -5,7 +5,6 @@ import {
VNode, VNode,
createElementVNode, createElementVNode,
createComponentVNode, createComponentVNode,
createTextVNode,
createFragment, createFragment,
createPortal, createPortal,
VNodeData, VNodeData,
@ -36,14 +35,6 @@ export type ElementType =
| typeof Fragment | typeof Fragment
| typeof Portal | typeof Portal
interface VNodeFactories {
c: typeof createComponentVNode
e: typeof createElementVNode
t: typeof createTextVNode
f: typeof createFragment
p: typeof createPortal
}
// This is used to differentiate the data object from // This is used to differentiate the data object from
// vnodes and arrays // vnodes and arrays
type Differ = { _isVNode?: never; [Symbol.iterator]?: never } type Differ = { _isVNode?: never; [Symbol.iterator]?: never }
@ -53,7 +44,7 @@ type OptionsComponent<P> =
| (ComponentOptions<P> & { render: Function }) | (ComponentOptions<P> & { render: Function })
// TODO improve return type with props information // TODO improve return type with props information
interface createElement extends VNodeFactories { interface createElement {
// element // element
(tag: string, children?: RawChildrenType): VNode (tag: string, children?: RawChildrenType): VNode
( (
@ -175,9 +166,3 @@ export const h = ((tag: ElementType, data?: any, children?: any): VNode => {
) )
} }
}) as createElement }) as createElement
h.c = createComponentVNode
h.e = createElementVNode
h.t = createTextVNode
h.f = createFragment
h.p = createPortal

View File

@ -1,7 +1,14 @@
// Core API // Core API
export { h, Fragment, Portal } from './h' export { h, Fragment, Portal } from './h'
export { Component } from './component' export { Component } from './component'
export { cloneVNode, createPortal, createFragment } from './vdom' export {
cloneVNode,
createElementVNode,
createComponentVNode,
createTextVNode,
createFragment,
createPortal
} from './vdom'
export { export {
createRenderer, createRenderer,
NodeOps, NodeOps,