10 lines
600 B
TypeScript
10 lines
600 B
TypeScript
|
type ElementProperties<T extends keyof HTMLElementTagNameMap> = {
|
||
|
[key in keyof HTMLElementTagNameMap[T]]: HTMLElementTagNameMap[T][key];
|
||
|
} & {
|
||
|
[key in keyof HTMLElementEventMap as `@${key}`]: (this: HTMLElement, ev: HTMLElementEventMap[key]) => void;
|
||
|
};
|
||
|
type DOMElem = Node | string;
|
||
|
type WithClassOrId<T extends keyof HTMLElementTagNameMap> = `${T}#${string}` | `${T}.${string}`;
|
||
|
export declare function $el<T extends keyof HTMLElementTagNameMap>(name: T | WithClassOrId<T>, ...desc: [Partial<ElementProperties<T>>, ...DOMElem[]] | DOMElem[]): HTMLElementTagNameMap[T];
|
||
|
export default $el;
|