diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 81c9d0c2c..b9bd67fc5 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -13395,6 +13395,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) */ + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: K): HTMLElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 4316f4510..e34301255 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -13384,6 +13384,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) */ + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: K): HTMLElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; diff --git a/baselines/ts5.6/dom.generated.d.ts b/baselines/ts5.6/dom.generated.d.ts index 932921bbd..a22d318bc 100644 --- a/baselines/ts5.6/dom.generated.d.ts +++ b/baselines/ts5.6/dom.generated.d.ts @@ -13392,6 +13392,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) */ + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: K): HTMLElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; diff --git a/baselines/ts5.9/dom.generated.d.ts b/baselines/ts5.9/dom.generated.d.ts index 598a7a214..e63d5bfbb 100644 --- a/baselines/ts5.9/dom.generated.d.ts +++ b/baselines/ts5.9/dom.generated.d.ts @@ -13392,6 +13392,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) */ + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: K): HTMLElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; diff --git a/inputfiles/addedTypes.jsonc b/inputfiles/addedTypes.jsonc index 64861d798..2aaf5fb47 100644 --- a/inputfiles/addedTypes.jsonc +++ b/inputfiles/addedTypes.jsonc @@ -240,6 +240,7 @@ "createElementNS": { "name": "createElementNS", "additionalSignatures": [ + "createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: K): HTMLElementTagNameMap[K]", "createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement", "createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: K): SVGElementTagNameMap[K]", "createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement", diff --git a/unittests/files/createelementns.ts b/unittests/files/createelementns.ts new file mode 100644 index 000000000..befd6830a --- /dev/null +++ b/unittests/files/createelementns.ts @@ -0,0 +1,7 @@ +const div: HTMLDivElement = document.createElementNS("http://www.w3.org/1999/xhtml", "div"); +const input: HTMLInputElement = document.createElementNS("http://www.w3.org/1999/xhtml", "input"); +const custom: HTMLElement = document.createElementNS("http://www.w3.org/1999/xhtml", "my-element"); +const circle: SVGCircleElement = document.createElementNS("http://www.w3.org/2000/svg", "circle"); + +// @ts-expect-error an XHTML div is not an input element +const wrong: HTMLInputElement = document.createElementNS("http://www.w3.org/1999/xhtml", "div");