Skip to content

Commit

Permalink
feat: handle default export
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 20, 2024
1 parent bc5d418 commit f7a9abd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ export async function extractTypeFromSource(filePath: string): Promise<string> {
}
}

// Handle default export
const defaultExportRegex = /export\s+default\s+(\w+)/
const defaultExportMatch = fileContent.match(defaultExportRegex)
if (defaultExportMatch) {
declarations += `export default ${defaultExportMatch[1]}\n`
}

// Generate import statements for used types
let importDeclarations = ''
importMap.forEach((types, path) => {
Expand Down

0 comments on commit f7a9abd

Please sign in to comment.