Skip to content

isUnion incorrect behavior #1351

@salisbury-espinosa

Description

@salisbury-espinosa

Bug description

let's say there is a type

type TestType =
  | { optionalField?: number; test1: number; test2: string }
  | { test1: number; test2: string };

so

type OptionalFieldType = TestType['optionalField'];

=> TS2339: Property optionalField does not exist on type TestType
=> its correct, BUT:

IsUnion<TestType> = false

const test: IsUnion<TestType> = true;

=> TS2322: Type true is not assignable to type false

but TestType - union....

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions