@@ -25,7 +25,7 @@ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
2525 value : string ;
2626}
2727
28- export const separatorArrayExplode = ( style : ArraySeparatorStyle ) => {
28+ export const separatorArrayExplode = ( style : ArraySeparatorStyle ) : '.' | ';' | ',' | '&' => {
2929 switch ( style ) {
3030 case 'label' :
3131 return '.' ;
@@ -38,7 +38,7 @@ export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
3838 }
3939} ;
4040
41- export const separatorArrayNoExplode = ( style : ArraySeparatorStyle ) => {
41+ export const separatorArrayNoExplode = ( style : ArraySeparatorStyle ) : ',' | '|' | '%20' => {
4242 switch ( style ) {
4343 case 'form' :
4444 return ',' ;
@@ -51,7 +51,7 @@ export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
5151 }
5252} ;
5353
54- export const separatorObjectExplode = ( style : ObjectSeparatorStyle ) => {
54+ export const separatorObjectExplode = ( style : ObjectSeparatorStyle ) : '.' | ';' | ',' | '&' => {
5555 switch ( style ) {
5656 case 'label' :
5757 return '.' ;
@@ -72,7 +72,7 @@ export const serializeArrayParam = ({
7272 value,
7373} : SerializeOptions < ArraySeparatorStyle > & {
7474 value : unknown [ ] ;
75- } ) => {
75+ } ) : string => {
7676 if ( ! explode ) {
7777 const joinedValues = ( allowReserved ? value : value . map ( v => encodeURIComponent ( v as string ) ) ) . join ( separatorArrayNoExplode ( style ) ) ;
7878 switch ( style ) {
@@ -104,7 +104,7 @@ export const serializeArrayParam = ({
104104 return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues ;
105105} ;
106106
107- export const serializePrimitiveParam = ( { allowReserved, name, value } : SerializePrimitiveParam ) => {
107+ export const serializePrimitiveParam = ( { allowReserved, name, value } : SerializePrimitiveParam ) : string => {
108108 if ( value === undefined || value === null ) {
109109 return '' ;
110110 }
@@ -126,7 +126,7 @@ export const serializeObjectParam = ({
126126} : SerializeOptions < ObjectSeparatorStyle > & {
127127 value : Record < string , unknown > | Date ;
128128 valueOnly ?: boolean ;
129- } ) => {
129+ } ) : string => {
130130 if ( value instanceof Date ) {
131131 return valueOnly ? value . toISOString ( ) : `${ name } =${ value . toISOString ( ) } ` ;
132132 }
0 commit comments