Closed
Description
TypeScript Version:
TypeScript 1.8.30.0
Issue
The following code (copy & paste from the TypeScript documentation) doesn't work. It generates a compiler error.
function createElement(tagName: "img"): HTMLImageElement;
function createElement(tagName: "input"): HTMLInputElement;
function createElement(tagName: string): Element;
// ... more overloads ...
function createElement(tagName: string): Element {
// ... code goes here ...
}
While, just moving the most general signature at the tip of the list will compile correctly.
function createElement(tagName: string): Element;
function createElement(tagName: "img"): HTMLImageElement;
function createElement(tagName: "input"): HTMLInputElement;
// ... more overloads ...
function createElement(tagName: string): Element {
// ... code goes here ...
}
Metadata
Metadata
Assignees
Labels
No labels