Skip to content

Commit dd0cbc8

Browse files
README cleanup
1 parent 829ce64 commit dd0cbc8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/collections/powersync-collection.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ There are two ways to create a collection: using type inference or using schema
8585

8686
#### Option 1: Using Table Type Inference
8787

88-
The collection types are automatically inferred from the PowerSync Schema Table definition. The table is used to construct a default StandardSchema validator which is used internally to validate collection operations.
88+
The collection types are automatically inferred from the PowerSync schema table definition. The table is used to construct a default standard schema validator which is used internally to validate collection operations.
8989

9090
```ts
9191
import { createCollection } from "@tanstack/react-db"
@@ -101,20 +101,20 @@ const documentsCollection = createCollection(
101101

102102
#### Option 2: Using Advanced Schema Validation
103103

104-
Additional validations can be performed by supplying a Standard Schema. The typing of the validator is constrained to match the typing of the SQLite table.
104+
Additional validations can be performed by supplying a compatible validation schema (such as a Zod schema). The typing of the validator is constrained to match the typing of the SQLite table.
105105

106106
```ts
107107
import { createCollection } from "@tanstack/react-db"
108-
import {
109-
powerSyncCollectionOptions,
110-
convertPowerSyncSchemaToSpecs,
111-
} from "@tanstack/powersync-db-collection"
108+
import { powerSyncCollectionOptions } from "@tanstack/powersync-db-collection"
112109
import { z } from "zod"
113110

114-
// The output of this schema must correspond to the SQLite schema
111+
// The output of this schema must match the SQLite schema
115112
const schema = z.object({
116113
id: z.string(),
117-
name: z.string().min(3, { message: errorMessage }).nullable(),
114+
name: z
115+
.string()
116+
.min(3, { message: "Should be at least 3 characters" })
117+
.nullable(),
118118
})
119119

120120
const documentsCollection = createCollection(
@@ -153,7 +153,7 @@ The `powerSyncCollectionOptions` function accepts the following options:
153153
interface PowerSyncCollectionConfig<T> {
154154
database: PowerSyncDatabase // PowerSync database instance
155155
table: Table // PowerSync schema table definition
156-
schema?: Schema // Optional schema for additional validation
156+
schema?: StandardSchemaV1 // Optional schema for additional validation (e.g., Zod schema)
157157
}
158158
```
159159

0 commit comments

Comments
 (0)