Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 21, 2024
1 parent 9f33cf4 commit 53468ea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function generateDtsTypes(sourceCode: string): string {
dtsLines.push(processed)
isMultiLineDeclaration = false
currentDeclaration = ''
bracketCount = 0
}
else {
isMultiLineDeclaration = true
Expand Down Expand Up @@ -122,13 +123,11 @@ function processConstDeclaration(declaration: string): string {
}

function processInterfaceDeclaration(declaration: string): string {
// Remove the function body if present
const interfaceBody = declaration.split('{')[1].split('}')[0]
return `export declare interface ${declaration.split(' ')[2]} {\n${interfaceBody}\n}`
return `export declare ${declaration.slice('export'.length).trim()}`
}

function processTypeDeclaration(declaration: string): string {
return declaration
return `export declare ${declaration.slice('export'.length).trim()}`
}

function processFunctionDeclaration(declaration: string): string {
Expand Down Expand Up @@ -176,7 +175,7 @@ function preserveValueType(value: string): string {
return value // Keep string literals as is
}
else {
return 'string' // Default to string for other cases
return value // Keep other values as is
}
}

Expand Down

0 comments on commit 53468ea

Please sign in to comment.