conditional-type-checks
conditional-type-checks copied to clipboard
IsExact does not handle `readonly` modifier
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.
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.