Update validation.ts (#3324)

Describe what your pull request does. If appropriate, add GIFs or images
showing the before and after.

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [ ] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [x] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [x] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know


### Test Plan

N/A

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Update example for Union type

---

I believe this type was changed and `literal` is what it should be now.
This commit is contained in:
Lorenzo Lewis 2024-05-21 17:28:52 +02:00 committed by GitHub
parent b7933d7e08
commit 38b1f7d0c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -821,8 +821,8 @@ export function dict<Key extends string, Value>(
* @example
*
* ```ts
* const catValidator = T.object({ kind: T.value('cat'), meow: T.boolean })
* const dogValidator = T.object({ kind: T.value('dog'), bark: T.boolean })
* const catValidator = T.object({ kind: T.literal('cat'), meow: T.boolean })
* const dogValidator = T.object({ kind: T.literal('dog'), bark: T.boolean })
* const animalValidator = T.union('kind', { cat: catValidator, dog: dogValidator })
* ```
*