API reference@evolu/commonType › IsData

type IsData<Value> = IsDataValue<Value, readonly []>;

Defined in: packages/common/src/Type.ts:13158

Returns whether a TypeScript type consists only of Data.

Unlike Value extends Data, this recursively checks the declared properties of object types, so ordinary interfaces do not need a string index signature. This is a compile-time approximation of the Data domain; representation details such as prototypes and property descriptors still require the runtime Data Type.

Recursive object types are supported.

Example

import { assertType, type IsData } from "@evolu/common";

interface User {
  readonly name: string;
  readonly roles: ReadonlySet<string>;
}

interface Service {
  readonly run: () => void;
}

assertType<true, IsData<User>>();
assertType<false, IsData<Service>>();