File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ export declare const someObject: {
16
16
someNestedArray : Array < Array < 1 | 2 | 3 > | Array < 4 | 5 | 6 | 7 | 8 | 9 | 10 > > ;
17
17
someNestedArray2 : Array < Array < 1 | 2 | 3 > | Array < 4 | 5 | 6 | 7 | 8 | 9 | 10 > | 'dummy value' > ;
18
18
someNestedArray3 : Array < Array < 1 | 2 | 3 > | Array < 4 | 5 | 6 | 7 | 8 | 9 | 10 > | 'dummy value' | Array < 11 | 12 | 13 > > ;
19
- someOtherNestedArray : Array < Array < 'some text' | 2 | ( ...args : any [ ] ) => void | ( ...args : any [ ] ) => void | unknown > | Array < 4 | 5 | 6 | 7 | 8 | 9 | 10 > > ;
20
- someComplexArray : Array < Array < { key : 'value' } > | Array < { key2 : 'value2' } | 'test' | 1000 > | Array < 'some string' | ( ...args : any [ ] ) => void | unknown > > ;
19
+ someOtherNestedArray : Array < Array < 'some text' | 2 | ( ( ...args : any [ ] ) => void ) | ( ( ...args : any [ ] ) => void ) | unknown > | Array < 4 | 5 | 6 | 7 | 8 | 9 | 10 > > ;
20
+ someComplexArray : Array < Array < { key : 'value' } > | Array < { key2 : 'value2' } | 'test' | 1000 > | Array < 'some string' | ( ( ...args : any [ ] ) => void ) | unknown > > ;
21
21
someObject : {
22
22
key : 'value' ;
23
23
} ;
Original file line number Diff line number Diff line change @@ -424,13 +424,12 @@ export function inferElementType(element: string): string {
424
424
425
425
// Handle function references and calls
426
426
if ( trimmed === 'console.log' || trimmed . endsWith ( '.log' ) ) {
427
- return '(...args: any[]) => void'
427
+ return '(( ...args: any[]) => void) '
428
428
}
429
429
430
430
// Handle arrow functions
431
431
if ( trimmed . includes ( '=>' ) ) {
432
- const arrowFn = trimmed . match ( / \( .* \) \s * = > \s * ( .* ) / )
433
- return '(...args: any[]) => void'
432
+ return '((...args: any[]) => void)'
434
433
}
435
434
436
435
// Handle function calls
@@ -463,8 +462,8 @@ export function processNestedArray(elements: string[]): string {
463
462
const nestedContent = extractNestedContent ( trimmed , '[' , ']' )
464
463
if ( nestedContent ) {
465
464
const nestedElements = splitArrayElements ( nestedContent )
466
- // Process each nested element to create a proper union type
467
465
const nestedTypes = nestedElements . map ( ne => inferElementType ( ne . trim ( ) ) )
466
+ // Ensure nested array types are properly formatted
468
467
return `Array<${ nestedTypes . join ( ' | ' ) } >`
469
468
}
470
469
return 'never'
You can’t perform that action at this time.
0 commit comments