better error handling and full jsx support
This commit is contained in:
parent
11be5e979c
commit
5197e3316d
7 changed files with 258 additions and 85 deletions
35
src/global.d.ts
vendored
35
src/global.d.ts
vendored
|
|
@ -5,16 +5,37 @@
|
|||
|
||||
/// <reference types="interest/jsx-runtime" />
|
||||
|
||||
import type { ChunkedStream } from "./stream.ts";
|
||||
import type { JsxElement } from "interest/jsx-runtime";
|
||||
|
||||
type HTMLAttributeMap<T = HTMLElement> = Partial<
|
||||
Omit<T, keyof Element | "children" | "style"> & {
|
||||
style?: string;
|
||||
class?: string;
|
||||
children?: any;
|
||||
[key: `data-${string}`]: string | number | boolean | null | undefined;
|
||||
[key: `aria-${string}`]: string | number | boolean | null | undefined;
|
||||
}
|
||||
>;
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
type Element = (chunks: ChunkedStream<string>) => Promise<void>;
|
||||
interface IntrinsicElements {
|
||||
[key: string]: ElementProps;
|
||||
}
|
||||
interface ElementProps {
|
||||
[key: string]: any;
|
||||
type Element = JsxElement;
|
||||
|
||||
export interface ElementChildrenAttribute {
|
||||
// deno-lint-ignore ban-types
|
||||
children: {};
|
||||
}
|
||||
|
||||
export type IntrinsicElements =
|
||||
& {
|
||||
[K in keyof HTMLElementTagNameMap]: HTMLAttributeMap<
|
||||
HTMLElementTagNameMap[K]
|
||||
>;
|
||||
}
|
||||
& {
|
||||
[K in keyof SVGElementTagNameMap]: HTMLAttributeMap<
|
||||
SVGElementTagNameMap[K]
|
||||
>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue