From 7656a21822a4f3de4fd7b23e43e13d818730d695 Mon Sep 17 00:00:00 2001 From: Kotaro Sugawara Date: Wed, 27 Apr 2022 09:23:47 +0900 Subject: [PATCH] refactor: improve PathParams type --- src/rest.ts | 2 +- src/utils/matching/matchRequestUrl.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rest.ts b/src/rest.ts index 1b650f8e7..47cc23076 100644 --- a/src/rest.ts +++ b/src/rest.ts @@ -12,7 +12,7 @@ function createRestHandler( ) { return < RequestBodyType extends DefaultBodyType = DefaultBodyType, - Params extends PathParams = PathParams, + Params extends PathParams = PathParams, ResponseBody extends DefaultBodyType = DefaultBodyType, >( path: Path, diff --git a/src/utils/matching/matchRequestUrl.ts b/src/utils/matching/matchRequestUrl.ts index d0b8c10fe..7a325d2ba 100644 --- a/src/utils/matching/matchRequestUrl.ts +++ b/src/utils/matching/matchRequestUrl.ts @@ -3,8 +3,8 @@ import { getCleanUrl } from '@mswjs/interceptors/lib/utils/getCleanUrl' import { normalizePath } from './normalizePath' export type Path = string | RegExp -export type PathParams>> = { - [K in keyof T]?: string | ReadonlyArray +export type PathParams = { + [P in K]?: string | ReadonlyArray } export interface Match {