diff --git a/src/RequestInterface.ts b/src/RequestInterface.ts index aae4e930f..e1b247025 100644 --- a/src/RequestInterface.ts +++ b/src/RequestInterface.ts @@ -34,7 +34,14 @@ export interface RequestInterface { * @param {string} route Request method + URL. Example: `'GET /orgs/{org}'` * @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. */ - (route: Route, options?: RequestParameters): Promise>; + ( + route: keyof Endpoints | R, + options?: R extends keyof Endpoints + ? Endpoints[R]["parameters"] & RequestParameters + : RequestParameters + ): R extends keyof Endpoints + ? Promise + : Promise>; /** * Returns a new `request` with updated route and parameters