Skip to content

Commit

Permalink
fix(R bindings): Avoid type recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Jun 20, 2021
1 parent f296c92 commit efdae5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ts/bindings/r.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ function anyOfToType(anyOf: JsonSchema[]): string {
)
if (types.length === 0) return ''
if (types.length === 1) return types[0]
return `Union(${types.join(', ')})`
return `Union(${types
// This mapping avoids the recursive union type definition that will
// arise otherwise for the `Node` union type.
.map((type) => (type === 'Array(Node)' ? 'Array("Node")' : type))
.join(', ')})`
}

/**
Expand Down

0 comments on commit efdae5c

Please sign in to comment.