@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
11 lines (10 loc) • 582 B
TypeScript
interface AnyHTMLElementTagNameMap extends HTMLElementTagNameMap {
[key: string]: HTMLElement;
}
type CreateElementChildren = string | Node | Array<string | Node>;
/**
* Functional DOM Element creation.
*/
export declare function createElement<T extends keyof AnyHTMLElementTagNameMap = 'div'>(tag?: T, children?: CreateElementChildren): AnyHTMLElementTagNameMap[T];
export declare function createElement<T extends keyof AnyHTMLElementTagNameMap = 'div'>(tag?: T, attributes?: Record<string, string>, children?: CreateElementChildren): AnyHTMLElementTagNameMap[T];
export {};