conditional-type-checks icon indicating copy to clipboard operation
conditional-type-checks copied to clipboard

IsExact does not handle `readonly` modifier

Open Yaojian opened this issue 2 years ago • 1 comments

IsExact returns true when the only difference between two interfaces is the readonly modifier.

    interface A {
      value: string;
    }

    interface B {
      readonly value: string;
    }

    assert<IsExact<A, B>>(false);     // fails the compiler because `IsExact` returns `true`

I consider it as a bug.

Yaojian avatar Aug 13 '22 15:08 Yaojian

Agreed. I have been using expect-type for this kind of thing, I believe it was inspired by this package, and has had a few bug fixes, and already covers correctly this case you reported.

papb avatar Aug 18 '22 01:08 papb