API reference / @evolu/common / Evolu/Internal / ValidateSchema
Type Alias: ValidateSchema<S>
type ValidateSchema<S> =
ValidateSchemaHasId<S> extends never
? ValidateIdColumnType<S> extends never
? ValidateNoDefaultColumns<S> extends never
? ValidateColumnTypes<S> extends never
? S
: ValidateColumnTypes<S>
: ValidateNoDefaultColumns<S>
: ValidateIdColumnType<S>
: ValidateSchemaHasId<S>;
Defined in: packages/common/src/Evolu/Schema.ts:94
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 must be a branded ID type (created with id() function)
- Tables cannot use default column names (createdAt, updatedAt, isDeleted)
- All column types must be compatible with SQLite (extend SqliteValue)
Type Parameters
Type Parameter |
---|
S extends EvoluSchema |