// Type definitions for create-html-element 2.0 // Project: https://github.com/sindresorhus/create-html-element#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 export = createHtmlElement; declare function createHtmlElement( options?: createHtmlElement.OptionsWithoutTagName ): HTMLDivElement; declare function createHtmlElement( options: createHtmlElement.Options ): HTMLElementTagNameMap[K]; declare function createHtmlElement(options: createHtmlElement.Options): HTMLElement; declare namespace createHtmlElement { type Without = { [P in Exclude]?: never }; type XOR = (T | U) extends object ? (Without & U) | (Without & T) : T | U; interface AttributesOptions { attributes?: { [key: string]: string | boolean | number | string[] }; } interface HtmlOptions { html?: string; } interface TextOptions { text?: string; } type OptionsWithoutTagName = AttributesOptions & XOR; interface OptionsWithTagName extends AttributesOptions { name: K; } type Options = OptionsWithTagName & XOR; }