Skip to content

Commit

Permalink
Optimize array output (fix #583)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherny committed Apr 20, 2024
1 parent 7c9ecd7 commit 9cbe26e
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 251 deletions.
4 changes: 4 additions & 0 deletions src/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export function optimize(ast: AST, options: Options, processed = new Set<AST>())
processed.add(ast)

switch (ast.type) {
case 'ARRAY':
return Object.assign(ast, {
params: optimize(ast.params, options, processed),
})
case 'INTERFACE':
return Object.assign(ast, {
params: ast.params.map(_ => Object.assign(_, {ast: optimize(_.ast, options, processed)})),
Expand Down

0 comments on commit 9cbe26e

Please sign in to comment.