@@ -21,13 +21,23 @@ export function registerHandlebarHelpers(root: { httpClient: HttpClient; useOpti
2121 Handlebars . registerHelper ( 'union' ,  function  ( this : any ,  properties : Model [ ] ,  parent : string  |  undefined ,  options : Handlebars . HelperOptions )  { 
2222 const  type  =  Handlebars . partials [ 'type' ] ; 
2323 const  types  =  properties . map ( property  =>  type ( {  ...root ,  ...property ,  parent } ) ) ; 
24-  return  options . fn ( types . filter ( unique ) . join ( ' | ' ) ) ; 
24+  const  uniqueTypes  =  types . filter ( unique ) ; 
25+  let  uniqueTypesString  =  uniqueTypes . join ( ' | ' ) ; 
26+  if  ( uniqueTypes . length  >  1 )  { 
27+  uniqueTypesString  =  `(${ uniqueTypesString }  ; 
28+  } 
29+  return  options . fn ( uniqueTypesString ) ; 
2530 } ) ; 
2631
2732 Handlebars . registerHelper ( 'intersection' ,  function  ( this : any ,  properties : Model [ ] ,  parent : string  |  undefined ,  options : Handlebars . HelperOptions )  { 
2833 const  type  =  Handlebars . partials [ 'type' ] ; 
2934 const  types  =  properties . map ( property  =>  type ( {  ...root ,  ...property ,  parent } ) ) ; 
30-  return  options . fn ( types . filter ( unique ) . join ( ' & ' ) ) ; 
35+  const  uniqueTypes  =  types . filter ( unique ) ; 
36+  let  uniqueTypesString  =  uniqueTypes . join ( ' & ' ) ; 
37+  if  ( uniqueTypes . length  >  1 )  { 
38+  uniqueTypesString  =  `(${ uniqueTypesString }  ; 
39+  } 
40+  return  options . fn ( uniqueTypesString ) ; 
3141 } ) ; 
3242
3343 Handlebars . registerHelper ( 'enumerator' ,  function  ( this : any ,  enumerators : Enum [ ] ,  parent : string  |  undefined ,  name : string  |  undefined ,  options : Handlebars . HelperOptions )  { 
0 commit comments