We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d49453 commit 4714ccaCopy full SHA for 4714cca
1 file changed
src/extract.ts
@@ -151,7 +151,15 @@ function processConstDeclaration(declaration: string, isExported = true): string
151
const lines = declaration.split('\n')
152
const firstLine = lines[0]
153
const name = firstLine.split('const')[1].split('=')[0].trim().split(':')[0].trim()
154
+ const typeMatch = firstLine.match(/const\s+\w+\s*:\s*([^=]+)\s*=/)
155
156
+ if (typeMatch) {
157
+ // If a type is defined, use it directly in the generated declaration
158
+ const type = typeMatch[1].trim()
159
+ return `${isExported ? 'export ' : ''}declare const ${name}: ${type};`
160
+ }
161
+
162
+ // If no type is defined, process the properties as before
163
const properties = lines.slice(1, -1).map((line) => {
164
let inString = false
165
let stringChar = ''
0 commit comments