const url = new URL('http://example.com') url.searchParams.append('foo', 1); const result = url.href; // http://example.com/?foo=1 // ^? string // `http://example.com/?${string}` ぐらいほしい const setPathParams = (path, pathParams) => path.replace(/{(.*?)}/g, (_, key) => pathParams[key]); // postIdではなく、正しくはuserIdなので型エラーになってほしい setPathParams('/users/{userId}', { postId : 1 }); const setQueryParams = ( p