Skip to content

Conditional type simplified too earlyΒ #46761

Closed
@webstrand

Description

@webstrand

Bug Report

πŸ”Ž Search Terms

conditional tuple extend simplify type parameter constraint

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about conditional types

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

type Bit = 0 | 1;
type And<A extends Bit, B extends Bit> = [A, B] extends [1, 1] ? 1 : 0;

type Test<A extends Bit, B extends Bit> = And<A extends 1 ? 0 : 1, B extends 1 ? 0 : 1>;
//    ^? type Test<I1 extends Bit, I2 extends Bit> = 1

type a = Test<1, 1>; // 1, should be 0

πŸ™ Actual behavior

Test<A, B> is being incorrectly simplified to 1 before being called, and Test<1, 1> is resolving incorrectly to 1.

πŸ™‚ Expected behavior

Test<A, B> should not be simplified, and Test<1, 1> should resolve to 0.

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions