diff --git a/packages/io-ts-http/src/httpRoute.ts b/packages/io-ts-http/src/httpRoute.ts index a2384299..f18aed71 100644 --- a/packages/io-ts-http/src/httpRoute.ts +++ b/packages/io-ts-http/src/httpRoute.ts @@ -13,8 +13,10 @@ export const Method = t.keyof({ export type Method = t.TypeOf; +export type PathString = `/${string}`; + export type HttpRoute = { - readonly path: string; + readonly path: PathString; readonly method: Uppercase; readonly request: HttpRequestCodec; readonly response: HttpResponse; diff --git a/packages/superagent-wrapper/src/request.ts b/packages/superagent-wrapper/src/request.ts index 41d9dd5e..3b53189e 100644 --- a/packages/superagent-wrapper/src/request.ts +++ b/packages/superagent-wrapper/src/request.ts @@ -201,7 +201,7 @@ export const requestForRoute = let path = route.path; for (const key in reqProps.params) { if (reqProps.params.hasOwnProperty(key)) { - path = path.replace(`{${key}}`, reqProps.params[key]); + path = path.replace(`{${key}}`, reqProps.params[key]) as h.PathString; } }