File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,25 @@ export interface Database {
225225 ( { name, type } ) => `${ JSON . stringify ( name ) } : ${ type } `
226226 ) } }`
227227 } ) ( ) }
228- Returns: ${ pgTypeToTsType ( return_type , types , schemas ) }
228+ Returns: ${ ( ( ) => {
229+ const tableArgs = args . filter ( ( { mode } ) => mode === 'table' )
230+
231+ if ( tableArgs . length > 0 ) {
232+ const argsNameAndType = tableArgs . map ( ( { name, type_id } ) => {
233+ const type = types . find ( ( { id } ) => id === type_id )
234+ if ( ! type ) {
235+ return { name, type : 'unknown' }
236+ }
237+ return { name, type : pgTypeToTsType ( type . name , types , schemas ) }
238+ } )
239+
240+ return `{ ${ argsNameAndType . map (
241+ ( { name, type } ) => `${ JSON . stringify ( name ) } : ${ type } `
242+ ) } }[]`
243+ }
244+
245+ return pgTypeToTsType ( return_type , types , schemas )
246+ } ) ( ) }
229247 }`
230248 )
231249 . join ( '|' ) } `
You can’t perform that action at this time.
0 commit comments