fix @Vendicated insanities
This commit is contained in:
parent
3fb6b6e2c2
commit
ff61e5ea04
3 changed files with 25 additions and 20 deletions
|
@ -1,13 +1,22 @@
|
|||
import { br } from "./br";
|
||||
|
||||
export const Fragment = Symbol("ComponentsJsx.Fragment");
|
||||
|
||||
type FunctionComponent = (props: any) => any;
|
||||
|
||||
export function createElement(type: typeof Fragment | FunctionComponent, props: any, ...children: any[]) {
|
||||
if (type === Fragment) {
|
||||
return children;
|
||||
}
|
||||
export function createElement(
|
||||
type: typeof Fragment | FunctionComponent,
|
||||
props: any,
|
||||
...children: any[]
|
||||
) {
|
||||
if (type === Fragment) {
|
||||
return children;
|
||||
}
|
||||
|
||||
props ??= {};
|
||||
props.children = children;
|
||||
return type(props);
|
||||
props ??= {};
|
||||
props.children = children;
|
||||
|
||||
// @ts-ignore
|
||||
if (type === "br") return "\n";
|
||||
return type(props);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue