better error handling and full jsx support

This commit is contained in:
laura 2025-11-01 17:21:09 -03:00
parent 11be5e979c
commit 5197e3316d
Signed by: w
GPG key ID: BCD2117C99E69817
7 changed files with 258 additions and 85 deletions

35
src/global.d.ts vendored
View file

@ -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]
>;
};
}
}