File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,9 @@ export const typify = (
255255 // we'll have to qualify it with the Node.js namespace.
256256 return 'NodeJS.ReadableStream' ;
257257 }
258+ // Custom type
259+ if ( innerTypes )
260+ return `${ typeAsString } <${ innerTypes . map ( ( innerType ) => typify ( innerType ) ) . join ( ', ' ) } >` ;
258261 return typeAsString ;
259262} ;
260263export const paramify = ( paramName : string ) => {
Original file line number Diff line number Diff line change @@ -102,6 +102,38 @@ describe('utils', () => {
102102 it ( 'should map node objects to the correct type' , ( ) => {
103103 expect ( utils . typify ( 'buffer' ) ) . toEqual ( 'Buffer' ) ;
104104 } ) ;
105+
106+ it ( 'should convert custom types with inner types' , ( ) => {
107+ expect (
108+ utils . typify ( {
109+ collection : false ,
110+ innerTypes : [
111+ {
112+ collection : false ,
113+ type : 'T' ,
114+ } ,
115+ ] ,
116+ type : 'Foo' ,
117+ } ) ,
118+ ) . toEqual ( 'Foo<T>' ) ;
119+
120+ expect (
121+ utils . typify ( {
122+ collection : false ,
123+ innerTypes : [
124+ {
125+ collection : false ,
126+ type : 'A' ,
127+ } ,
128+ {
129+ collection : false ,
130+ type : 'B' ,
131+ } ,
132+ ] ,
133+ type : 'Foo' ,
134+ } ) ,
135+ ) . toEqual ( 'Foo<A, B>' ) ;
136+ } ) ;
105137 } ) ;
106138
107139 describe ( 'paramify' , ( ) => {
You can’t perform that action at this time.
0 commit comments