@@ -62,7 +62,7 @@ type KeyMap = Map<
6262 }
6363> ;
6464
65- const buildKeyMap = ( fields : FieldsConfig , map ?: KeyMap ) : KeyMap => {
65+ function buildKeyMap ( fields : FieldsConfig , map ?: KeyMap ) : KeyMap {
6666 if ( ! map ) {
6767 map = new Map ( ) ;
6868 }
@@ -85,7 +85,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
8585 }
8686
8787 return map ;
88- } ;
88+ }
8989
9090interface Params {
9191 body : unknown ;
@@ -94,16 +94,18 @@ interface Params {
9494 query : Record < string , unknown > ;
9595}
9696
97- const stripEmptySlots = ( params : Params ) => {
97+ type ParamsSlotMap = Record < Slot , unknown > ;
98+
99+ function stripEmptySlots ( params : ParamsSlotMap ) : void {
98100 for ( const [ slot , value ] of Object . entries ( params ) ) {
99101 if ( value && typeof value === 'object' && ! Array . isArray ( value ) && ! Object . keys ( value ) . length ) {
100102 delete params [ slot as Slot ] ;
101103 }
102104 }
103- } ;
105+ }
104106
105- export const buildClientParams = ( args : ReadonlyArray < unknown > , fields : FieldsConfig ) => {
106- const params : Params = {
107+ export function buildClientParams ( args : ReadonlyArray < unknown > , fields : FieldsConfig ) : Params {
108+ const params : ParamsSlotMap = {
107109 body : Object . create ( null ) ,
108110 headers : Object . create ( null ) ,
109111 path : Object . create ( null ) ,
@@ -165,5 +167,5 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
165167
166168 stripEmptySlots ( params ) ;
167169
168- return params ;
169- } ;
170+ return params as Params ;
171+ }
0 commit comments