From 0cd8183fbfb16d332632c0880d64fdbdf911195f Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 13 Nov 2018 01:08:22 -0500 Subject: [PATCH] refactor: remove shorthands on h --- packages/runtime-core/src/h.ts | 17 +---------------- packages/runtime-core/src/index.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/packages/runtime-core/src/h.ts b/packages/runtime-core/src/h.ts index 627ea0fa..c2dc3be4 100644 --- a/packages/runtime-core/src/h.ts +++ b/packages/runtime-core/src/h.ts @@ -5,7 +5,6 @@ import { VNode, createElementVNode, createComponentVNode, - createTextVNode, createFragment, createPortal, VNodeData, @@ -36,14 +35,6 @@ export type ElementType = | typeof Fragment | 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 // vnodes and arrays type Differ = { _isVNode?: never; [Symbol.iterator]?: never } @@ -53,7 +44,7 @@ type OptionsComponent

= | (ComponentOptions

& { render: Function }) // TODO improve return type with props information -interface createElement extends VNodeFactories { +interface createElement { // element (tag: string, children?: RawChildrenType): VNode ( @@ -175,9 +166,3 @@ export const h = ((tag: ElementType, data?: any, children?: any): VNode => { ) } }) as createElement - -h.c = createComponentVNode -h.e = createElementVNode -h.t = createTextVNode -h.f = createFragment -h.p = createPortal diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index fc5d1ca3..edfd24ed 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -1,7 +1,14 @@ // Core API export { h, Fragment, Portal } from './h' export { Component } from './component' -export { cloneVNode, createPortal, createFragment } from './vdom' +export { + cloneVNode, + createElementVNode, + createComponentVNode, + createTextVNode, + createFragment, + createPortal +} from './vdom' export { createRenderer, NodeOps,