Skip to content

Commit

Permalink
Revision 0.9.13
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 committed Apr 27, 2024
1 parent be86b40 commit a0cc8ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sinclair/typebox-codegen",
"version": "0.9.12",
"version": "0.9.13",
"description": "Code Generation Tools for TypeBox",
"main": "index.js",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions src/model/model-to-typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export namespace ModelToTypeScript {
return 'number'
}
function Intersect(schema: Types.TIntersect) {
return schema.allOf.map((schema) => Visit(schema)).join(' & ')
return `(${schema.allOf.map((schema) => Visit(schema)).join(' & ')})`
}
function Literal(schema: Types.TLiteral) {
if (typeof schema.const === 'string') {
Expand Down Expand Up @@ -128,7 +128,7 @@ export namespace ModelToTypeScript {
return `undefined`
}
function Union(schema: Types.TUnion) {
return schema.anyOf.map((schema) => Visit(schema)).join(' | ')
return `(${schema.anyOf.map((schema) => Visit(schema)).join(' | ')})`
}
function Unknown(schema: Types.TUnknown) {
return `unknown`
Expand Down

0 comments on commit a0cc8ba

Please sign in to comment.