Skip to content

Generic type resolving broken in typescript@next #44453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
awerlogus opened this issue Jun 5, 2021 · 3 comments
Closed

Generic type resolving broken in typescript@next #44453

awerlogus opened this issue Jun 5, 2021 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@awerlogus
Copy link

Bug Report

🔎 Search Terms generic type resolve

🕗 Version & Regression Information 4.4.0-dev.20210605

💻 Code

/** @template T @typedef {T | undefined} Option */

/** @type {<T1, T2>(x: Option<T1>, y: T2) => T1 | T2} */
const a = (x, y) => x !== undefined ? x : y

// Making 'number | undefined' value
/** @type {{ prop?: number }} */
const b = { prop: 1 }
const { prop } = b

// 4.3: number
// 4.4: number | undefined
const c = a(prop, 2)

🙁 Actual behavior

undefined is a part of generic T1

🙂 Expected behavior

undefined is excluded from generic T1

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 9, 2021
@RyanCavanaugh
Copy link
Member

I triaged a duplicate of this yesterday and can't find it, so tagging this as bug 😬. It repros in non-JS Doc type space as well

@ahejlsberg
Copy link
Member

@awerlogus I'm unable to repro this issue. Can you let us know exactly what your config settings are?

@ahejlsberg
Copy link
Member

@awerlogus Actually, it does repro, just not in the playground for some reason. It is fixed by #44565 and basically a duplicate of #44388, so I will close it as such.

@ahejlsberg ahejlsberg added Duplicate An existing issue was already created and removed Bug A bug in TypeScript labels Jun 13, 2021
@ahejlsberg ahejlsberg removed this from the TypeScript 4.4.1 (RC) milestone Jun 13, 2021
@andrewbranch andrewbranch removed their assignment Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants