-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
TypeScript Version: 3.5.1, 3.8.3
Search Terms:
conditional types, generics, equality
Code
strictNullChecks and strictFunctionTypes enabled
export type Equals<A1 extends any, A2 extends any> =
(<A>() => A extends A1 ? 1 : 0) extends (<A>() => A extends A2 ? 1 : 0)
? 1
: 0
interface Foo<T> {
x : () => T
}
declare const a: Foo<Date>;
declare const b: Foo<Date | null>;
//Expected 0, Actual 1
type ShouldBe0 = Equals<typeof a, typeof b>;
Expected behavior:
Evaluates to 0
Actual behavior:
Evaluates to 1
Related Issues: Not that I know of
I filed this issue over here as well, millsp/ts-toolbelt#97
Looking at the type, it should work. But it doesn't. I think it might indicate something is broken with TS
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone