File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/transforms/v2-to-v3/ts-type Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,9 @@ export const getTypeRefForString = (
24
24
return j . tsTypeReference ( j . identifier ( v3ClientTypeString ) ) ;
25
25
}
26
26
27
- if ( v3ClientTypeString . startsWith ( "Array<" ) ) {
28
- const type = arrayRegex . exec ( v3ClientTypeString ) ! [ 1 ] ;
27
+ const arrayRegexMatches = arrayRegex . exec ( v3ClientTypeString ) ;
28
+ if ( arrayRegexMatches ) {
29
+ const type = arrayRegexMatches [ 1 ] ;
29
30
const typeArgument = getTypeRefForString ( j , v3ClientDefaultLocalName , type ) ;
30
31
return j . tsTypeReference . from ( {
31
32
typeName : j . identifier ( "Array" ) ,
@@ -35,8 +36,9 @@ export const getTypeRefForString = (
35
36
} ) ;
36
37
}
37
38
38
- if ( v3ClientTypeString . startsWith ( "Record<" ) ) {
39
- const type = recordRegex . exec ( v3ClientTypeString ) ! [ 1 ] ;
39
+ const recordRegexMatches = recordRegex . exec ( v3ClientTypeString ) ;
40
+ if ( recordRegexMatches ) {
41
+ const type = recordRegexMatches [ 1 ] ;
40
42
const typeArgument = getTypeRefForString ( j , v3ClientDefaultLocalName , type ) ;
41
43
return j . tsTypeReference . from ( {
42
44
typeName : j . identifier ( "Record" ) ,
You can’t perform that action at this time.
0 commit comments