Skip to content

Commit de43700

Browse files
authored
Revision 0.34.19 (#1166)
* Documentation * Version
1 parent 6b76fb9 commit de43700

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sinclair/typebox",
3-
"version": "0.34.18",
3+
"version": "0.34.19",
44
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
55
"keywords": [
66
"typescript",

readme.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -1390,25 +1390,26 @@ const S = Syntax({ T }, `{ x: T, y: T, z: T }`) // const S: TObject<{
13901390
13911391
### Generics
13921392
1393-
Generic types can be created by passing Argument types as parameters.
1393+
Generic types can be created using Argument types.
13941394
13951395
```typescript
1396-
// Generic Vector Type
1397-
1398-
const Vector = Syntax({ // type Vector<X, Y, Z> = {
1399-
X: Type.Argument(0), // x: X
1400-
Y: Type.Argument(1), // y: Y,
1401-
Z: Type.Argument(2) // z: Z
1402-
}, // }
1403-
`{
1404-
x: X,
1405-
y: Y,
1406-
z: Z
1396+
const Vector = Syntax(`{
1397+
x: Argument<0>,
1398+
y: Argument<1>,
1399+
z: Argument<2>
14071400
}`)
14081401

1409-
// Instanced Vector Type
1402+
const Basis = Syntax({ Vector }, `{
1403+
x: Vector<1, 0, 0>,
1404+
y: Vector<0, 1, 0>,
1405+
z: Vector<0, 0, 1>,
1406+
}`)
14101407

1411-
const Up = Syntax({ Vector }, `Vector<0, 1, 0>`) // type Up = Vector<0, 1, 0>
1408+
type Basis = Static<typeof Basis> // type Basis = {
1409+
// x: { x: 1, y: 0, z: 0 },
1410+
// y: { x: 0, y: 1, z: 0 },
1411+
// z: { x: 0, y: 0, z: 1 }
1412+
// }
14121413
```
14131414
14141415
<a name='typeregistry'></a>

0 commit comments

Comments
 (0)