Skip to content

Commit c44e042

Browse files
committed
chore: wip
1 parent 6cdeeab commit c44e042

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/extract.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function generateDtsTypes(sourceCode: string): string {
3737
continue
3838
}
3939

40-
if (line.trim().startsWith('export') && !line.includes('{')) {
40+
if (line.trim().startsWith('export') && (line.includes('{') || line.includes('*'))) {
4141
exports.push(line)
4242
continue
4343
}
@@ -215,7 +215,7 @@ function preserveValueType(value: string): string {
215215
return value // Keep string literals as is
216216
}
217217
else {
218-
return 'any' // Default to any for other cases
218+
return 'string' // Default to string for other cases
219219
}
220220
}
221221

@@ -224,5 +224,7 @@ function cleanOutput(output: string): string {
224224
.replace(/\{\s*\}/g, '{}') // Replace empty objects with {}
225225
.replace(/\s*;\s*(?=\}|$)/g, ';') // Clean up semicolons before closing braces or end of string
226226
.replace(/\n+/g, '\n') // Remove multiple consecutive newlines
227+
.replace(/;\n\}/g, ';\n }') // Add indentation to closing brace of object literals
228+
.replace(/\{;/g, '{') // Remove unnecessary semicolons after opening braces
227229
.trim()
228230
}

0 commit comments

Comments
 (0)