-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueA PR has been merged for this issuecheckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript
Milestone
Description
TypeScript Version: 3.0.0-dev.20180707
Code
/** @typedef {"a" | "b"} U */
/** @return {U} */
function f0() { return "a"; }
/** @type {() => U} */
function f1() { return "a"; }
/** @typedef {() => U} RetU */
/** @type {RetU} */
function f2() { return "a"; }
/** @type {RetU} */
const f3 = () => "a";
const x0 = f0();
const x1 = f1();
const x2 = f2();
const x3 = f3();Expected behavior:
x0 through x3 are all of type "a" | "b".
Actual behavior:
x2 is of type string.
Noticed while reviewing #25486.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueA PR has been merged for this issuecheckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript