API reference › @evolu/common › Types › IsSameType
type IsSameType<A, B> = <T>() => T extends (A & T) | T
? true
: false extends <T>() => T extends (B & T) | T ? true : false
? [A] extends [never]
? [B] extends [never]
? true
: false
: [B] extends [never]
? false
: true
: false;
Defined in: packages/common/src/Types.ts:443
Returns whether two types are identical according to TypeScript.
Unlike mutual assignability, this distinguishes narrower literals, any,
unknown, never, optional properties, and readonly properties.
Intersection types are not normalized; apply Simplify explicitly when
normalization is part of the intended comparison.
Exact type equality
import { assertType, type IsSameType } from "@evolu/common";
assertType<
true,
IsSameType<{ readonly id: string }, { readonly id: string }>
>();
assertType<false, IsSameType<"ready", string>>();