import type { UrlParam } from '../hooks/useParam' ; const buildParamQuery = < T > ( urlParam , newValue ) : URLSearchParams => { const newParams = new URLSearchParams ( window . location . search ) ; if ( newValue ) { newParams . set ( urlParam . name , newValue ) ; } else { newParams . delete ( urlParam . name ) ; } newParams . sort ( ) ; return newParams ; } ; export default buildParamQuery ;