API reference › @evolu/common › local‑first/Schema › ValidateSchema
type ValidateSchema<S> =
ValidateSchemaHasId<S> extends never
? ValidateIdColumnType<S> extends never
? ValidateNoSystemColumns<S> extends never
? ValidateColumnTypes<S> extends never
? S
: ValidateColumnTypes<S>
: ValidateNoSystemColumns<S>
: ValidateIdColumnType<S>
: ValidateSchemaHasId<S>;
Defined in: packages/common/src/local-first/Schema.ts:107
Validates an EvoluSchema at compile time, returning the first error found as a readable string literal type. This approach provides much clearer and more actionable TypeScript errors than the default, which are often hard to read.
Validates the following schema requirements:
- All tables must have an 'id' column
- The 'id' column output type must extend Id
- Tables cannot use system column names (createdAt, updatedAt, isDeleted)
- All column output types must be compatible with SQLite (extend SqliteValue)