Skip to content

Commit

Permalink
docs: add nullable to the README (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet authored Dec 18, 2024
1 parent 4414462 commit 86690e3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/string-store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ const schema = new Schema(Id.Planets).fixedLengthArray('names', t.string, 3);
// → Schema<Id.Planets, { names: [string, string, string] }>
```

### `nullable`

Adds a nullable property of the specified type to the schema.

```ts
// A schema with a single field `capitalId` that is a nullable string:

const schema = new Schema(Id.Planets).nullable('capitalId', t.uint32);
// → Schema<Id.Planets, { capitalId: number | null }>
```

To track whether or not a property is optional, it will serialize a [bit](#bit), which signals whether or not the value
is defined, due to this, its bit size is `null`.

### `string`

Adds a string to the schema.
Expand Down

0 comments on commit 86690e3

Please sign in to comment.