(elementType: string, props: any)
| 2 | import { IElement } from "./elements/BaseElement"; |
| 3 | |
| 4 | export default function createElement(elementType: string, props: any) { |
| 5 | const Element: IElement = elements[elementType]; |
| 6 | if (!Element) throw new Error(`unknown element of type '${elementType}'`); |
| 7 | return new Element(props); |
| 8 | } |