Skip to content

Type created with union loses its part after Omit #43883

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
everdimension opened this issue Apr 29, 2021 · 3 comments
Closed

Type created with union loses its part after Omit #43883

everdimension opened this issue Apr 29, 2021 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@everdimension
Copy link

Bug Report

πŸ”Ž Search Terms

omit loses type info union generic

πŸ•— Version & Regression Information

Version: 4.2.4

  • I was unable to test this on prior versions because omg it's exhausting

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

interface Base<T> {
  x: T,
  y: number;
}

type Additional = { a: number } | { b: string };
type Specific<T> = Base<T> & Additional;

type Final<T> = Omit<Specific<T>, 'y'>

const x: Final<number> = { x: 23 }; // must warn about missing 'a' | 'b', but doesn't

πŸ™ Actual behavior

Final type doesn't have properties of type Additional

πŸ™‚ Expected behavior

Final type must properties of type Additional

@MartinJohns
Copy link
Contributor

Duplicate of #39556.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 29, 2021
@RyanCavanaugh
Copy link
Member

RyanCavanaugh commented Apr 29, 2021

omg it's exhausting

No one is forcing you to fill out this report; please just refrain from doing so if you aren't able to complete the steps asked of you. We put those steps in there for a reason and I assure you someone else will log the issue if it's legitimate. (That said, lol, I feel you)

@everdimension
Copy link
Author

@RyanCavanaugh this wasn't meant as an attack. Just the first thing I felt when reading the template. Also the template comment asked to keep one line.
Thanks for understanding! πŸ™‚

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

3 participants