API reference › @evolu/common › local‑first/Schema › testEvoluSchema
const testEvoluSchema: {
project: {
id: TableId<"Project">;
name: BrandType<
BrandType<
BrandType<
Type<
"String",
string,
string,
TypeOfError<"String">,
null,
TypeOfError<"String">,
never,
string,
true
>,
"Trimmed",
TrimmedError
>,
"MinLength1",
MinLengthError<1>
>,
"MaxLength100",
MaxLengthError<100>
>;
};
todo: {
id: TableId<"Todo">;
isCompleted: UnionType<
readonly [
UnionType<readonly [LiteralType<0>, LiteralType<1>]>,
LiteralType<null>,
]
>;
projectId: UnionType<readonly [TableId<"Project">, LiteralType<null>]>;
title: BrandType<
BrandType<
BrandType<
Type<
"String",
string,
string,
TypeOfError<"String">,
null,
TypeOfError<"String">,
never,
string,
true
>,
"Trimmed",
TrimmedError
>,
"MinLength1",
MinLengthError<1>
>,
"MaxLength100",
MaxLengthError<100>
>;
};
};
Defined in: packages/common/src/local-first/Schema.ts:211
Todo and project schema for tests and examples. A todo can belong to a project or have no project. Use an explicit schema when teaching schema definition.
Example
import {
assertOk,
testEvoluSchema,
testProjectId,
testTodoId,
} from "@evolu/common";
assertOk(testEvoluSchema.todo.id.from(testTodoId), testTodoId);
assertOk(testEvoluSchema.todo.projectId.from(testProjectId), testProjectId);
Type Declaration
| Name | Type | Default value | Defined in |
|---|---|---|---|
project | { id: TableId<"Project">; name: BrandType<BrandType<BrandType<Type<"String", string, string, TypeOfError<"String">, null, TypeOfError<"String">, never, string, true>, "Trimmed", TrimmedError>, "MinLength1", MinLengthError<1>>, "MaxLength100", MaxLengthError<100>>; } | - | packages/common/src/local-first/Schema.ts:218 |
project.id | TableId<"Project"> | TestProjectId | packages/common/src/local-first/Schema.ts:219 |
project.name | BrandType<BrandType<BrandType<Type<"String", string, string, TypeOfError<"String">, null, TypeOfError<"String">, never, string, true>, "Trimmed", TrimmedError>, "MinLength1", MinLengthError<1>>, "MaxLength100", MaxLengthError<100>> | NonEmptyTrimmedString100 | packages/common/src/local-first/Schema.ts:220 |
todo | { id: TableId<"Todo">; isCompleted: UnionType<readonly [UnionType<readonly [LiteralType<0>, LiteralType<1>]>, LiteralType<null>]>; projectId: UnionType<readonly [TableId<"Project">, LiteralType<null>]>; title: BrandType<BrandType<BrandType<Type<"String", string, string, TypeOfError<"String">, null, TypeOfError<"String">, never, string, true>, "Trimmed", TrimmedError>, "MinLength1", MinLengthError<1>>, "MaxLength100", MaxLengthError<100>>; } | - | packages/common/src/local-first/Schema.ts:212 |
todo.id | TableId<"Todo"> | TestTodoId | packages/common/src/local-first/Schema.ts:213 |
todo.isCompleted | UnionType<readonly [UnionType<readonly [LiteralType<0>, LiteralType<1>]>, LiteralType<null>]> | - | packages/common/src/local-first/Schema.ts:215 |
todo.projectId | UnionType<readonly [TableId<"Project">, LiteralType<null>]> | - | packages/common/src/local-first/Schema.ts:216 |
todo.title | BrandType<BrandType<BrandType<Type<"String", string, string, TypeOfError<"String">, null, TypeOfError<"String">, never, string, true>, "Trimmed", TrimmedError>, "MinLength1", MinLengthError<1>>, "MaxLength100", MaxLengthError<100>> | NonEmptyTrimmedString100 | packages/common/src/local-first/Schema.ts:214 |