initial jsx support
This commit is contained in:
parent
2301c5d631
commit
11be5e979c
7 changed files with 77 additions and 30 deletions
|
|
@ -71,9 +71,9 @@ type TagFn = {
|
|||
(fn: () => any): TagRes;
|
||||
};
|
||||
|
||||
type HtmlProxy = { [K in keyof HTMLElementTagNameMap]: TagFn } & {
|
||||
export type HtmlProxy = { [K in keyof HTMLElementTagNameMap]: TagFn } & {
|
||||
[key: string]: TagFn;
|
||||
};
|
||||
} & { render(child: any): Promise<void> };
|
||||
|
||||
const isTemplateLiteral = (arg: any): arg is TemplateStringsArray =>
|
||||
Array.isArray(arg) && "raw" in arg;
|
||||
|
|
@ -125,5 +125,8 @@ export function html(
|
|||
},
|
||||
};
|
||||
|
||||
return new Proxy({}, handler) as HtmlProxy;
|
||||
const proxy = new Proxy({}, handler) as HtmlProxy;
|
||||
proxy.render = async (stuff: any) => void write(await render(stuff));
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue