Skip to content

Commit 64e8811

Browse files
committed
chore: wip
1 parent 9cd4e4e commit 64e8811

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

fixtures/output/example-0001.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ export declare function loadConfig<T extends Record<string, unknown>>({ name, cw
8585
declare const dtsConfig: DtsGenerationConfig;
8686

8787
export { generate, dtsConfig }
88+
8889
export type { DtsGenerationOption }
90+
8991
export declare interface ComplexGeneric<T extends Record<string, unknown>, K extends keyof T> {
9092
data: T
9193
key: K

src/extract.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,8 @@ function formatOutput(state: ProcessingState): string {
21332133
// Process imports
21342134
const imports = state.imports.join('\n').trim()
21352135
if (imports) {
2136-
sections.push(`${imports}\n`) // Add extra newline after imports
2136+
sections.push(imports)
2137+
sections.push('') // Add empty line after imports
21372138
}
21382139

21392140
// Process declarations with proper spacing
@@ -2145,10 +2146,12 @@ function formatOutput(state: ProcessingState): string {
21452146
.reduce((acc: string[], line: string) => {
21462147
if (line.trim()) {
21472148
acc.push(line)
2148-
// Add newline after declaration statements
2149+
// Add newline after declaration statements and direct exports
21492150
if (
21502151
line.match(/^export\s+declare\s+(const|interface|function|type|class|enum|namespace|module|global|abstract\s+class)/)
21512152
|| line.match(/^declare\s+(const|interface|function|type|class|enum|namespace|module|global|abstract\s+class)/)
2153+
|| line.match(/^export\s+\{/) // Match direct exports like "export { generate, dtsConfig }"
2154+
|| line.match(/^export\s+type\s+\{/) // Match type exports like "export type { DtsGenerationOption }"
21522155
) {
21532156
acc.push('')
21542157
}

0 commit comments

Comments
 (0)