File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 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) {
116116 * TODO: Replace with a more robust solution.
117117 */
118118export 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, "" ) ;
120120}
121121
122122export function getClassesFromService ( node : SourceFile ) {
Original file line number Diff line number Diff line change @@ -80,6 +80,15 @@ describe("common", () => {
8080 const result = getShortType ( type ) ;
8181 expect ( result ) . toBe ( "MyType" ) ;
8282 } ) ;
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+ } ) ;
8392 } ) ;
8493
8594 test ( "formatOptions - converts string boolean to boolean (false)" , ( ) => {
You can’t perform that action at this time.
0 commit comments