Skip to content

Type created with union loses its part after OmitΒ #43883

Closed
@everdimension

Description

@everdimension

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions