Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into simplify_strict_equals
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed Apr 13, 2023
2 parents bd7275a + feff1e3 commit b39fe06
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ test('parity with IsExact from conditional-type-checks', () => {
test('Equal works with functions', () => {
expectTypeOf<a.Equal<() => void, () => string>>().toEqualTypeOf<false>()
expectTypeOf<a.Equal<() => void, (s: string) => void>>().toEqualTypeOf<false>()
// todo: workaround https://github.com/microsoft/TypeScript/issues/50670 - https://github.com/mmkal/expect-type/issues/5
// expectTypeOf<a.Equal<() => () => () => void, () => () => () => string>>().toEqualTypeOf<false>()
expectTypeOf<a.Equal<() => () => () => void, () => (s: string) => () => void>>().toEqualTypeOf<false>()
})

Expand Down Expand Up @@ -647,3 +645,11 @@ test('Distinguish between identical types that are AND`d together', () => {
// @ts-expect-error
expectTypeOf<{foo: number} & {foo: number}>().not.toEqualTypeOf<{foo: number}>()
})

test('limitations', () => {
// these *shouldn't* fail, but kept here to document missing behaviours. Once fixed, remove the expect-error comments to make sure they can't regress
// @ts-expect-error typescript can't handle the truth: https://github.com/mmkal/expect-type/issues/5 https://github.com/microsoft/TypeScript/issues/50670
expectTypeOf<a.Equal<() => () => () => void, () => () => () => string>>().toEqualTypeOf<false>()

expectTypeOf<(() => 1) & {x: 1}>().not.toEqualTypeOf<() => 1>()
})

0 comments on commit b39fe06

Please sign in to comment.