@@ -5,20 +5,17 @@ export function declareDataTypes(schema: Schema): string {
55 let output = `declare global {\n` ;
66
77 if ( schema . data ) {
8- output += generateDataObjectComment ( schema . data , " " ) ;
9- //output += ` const data: {\n`;
108 Object . entries ( schema . data ) . forEach ( ( [ dataKey , dataSchema ] ) => {
11- output += generateNestedPropertyJSDoc ( dataKey , dataSchema , " " ) ;
9+ output += generateNestedPropertyJSDoc ( dataKey , dataSchema , " " ) ;
1210
1311 const type = mapSchemaTypeToTypeScript ( dataSchema ) ;
1412
1513 const indentedType = type . includes ( "\n" ) ? type . replace ( / \n / g, "\n " ) . replace ( / \n { 4 } $ / , "\n " ) : type ;
1614 output += ` ${ dataKey } : ${ indentedType } ;\n` ;
1715 } ) ;
18- output += ` };\n` ;
1916 }
2017
21- // output += ` }\n\n`;
18+ output += `}\n\n` ;
2219 output += `export {};\n` ;
2320
2421 return output ;
@@ -74,36 +71,3 @@ function generateNestedPropertyJSDoc(propertyName: string, propertySchema: any,
7471
7572 return output ;
7673}
77-
78- function generateDataObjectComment ( dataSchema : any , indent : string = "" ) : string {
79- const comments : string [ ] = [ ] ;
80-
81- comments . push ( "Data object for JSX expressions" ) ;
82- comments . push ( "" ) ;
83-
84- Object . entries ( dataSchema ) . forEach ( ( [ dataKey , schema ] : [ string , any ] ) => {
85- if ( schema . description ) {
86- comments . push ( `@property ${ dataKey } ${ schema . description } ` ) ;
87- } else {
88- const desc =
89- dataKey . charAt ( 0 ) . toUpperCase ( ) +
90- dataKey
91- . slice ( 1 )
92- . replace ( / ( [ A - Z ] ) / g, " $1" )
93- . toLowerCase ( ) ;
94- comments . push ( `@property ${ dataKey } ${ desc } ` ) ;
95- }
96- } ) ;
97-
98- let output = `${ indent } /**\n` ;
99- comments . forEach ( ( comment ) => {
100- if ( comment === "" ) {
101- output += `${ indent } *\n` ;
102- } else {
103- output += `${ indent } * ${ comment } \n` ;
104- }
105- } ) ;
106- output += `${ indent } */\n` ;
107-
108- return output ;
109- }
0 commit comments