File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export function extractPropertiesFromObjectParam(param: ParameterDeclaration) {
116
116
* TODO: Replace with a more robust solution.
117
117
*/
118
118
export function getShortType ( type : string ) {
119
- return type . replaceAll ( / i m p o r t \( " .* " \) \. / g, "" ) ;
119
+ return type . replaceAll ( / i m p o r t \( " .* ? " \) \. / g, "" ) ;
120
120
}
121
121
122
122
export function getClassesFromService ( node : SourceFile ) {
Original file line number Diff line number Diff line change @@ -80,6 +80,15 @@ describe("common", () => {
80
80
const result = getShortType ( type ) ;
81
81
expect ( result ) . toBe ( "MyType" ) ;
82
82
} ) ;
83
+
84
+ test ( "json" , ( ) => {
85
+ const type =
86
+ '{ import1?: import("/path/to/import1").Import1; import2: import("/path/to/import2").Import2; import3: import("/path/to/import3").Import3; }' ;
87
+ const result = getShortType ( type ) ;
88
+ expect ( result ) . toBe (
89
+ "{ import1?: Import1; import2: Import2; import3: Import3; }" ,
90
+ ) ;
91
+ } ) ;
83
92
} ) ;
84
93
85
94
test ( "formatOptions - converts string boolean to boolean (false)" , ( ) => {
You can’t perform that action at this time.
0 commit comments