Skip to content

fix: Correct TypeScript overload signatures in FetchMock.route()#992

Open
MatrixNeoKozak wants to merge 1 commit into
wheresrhys:mainfrom
MatrixNeoKozak:scout-improvement-1780257176946
Open

fix: Correct TypeScript overload signatures in FetchMock.route()#992
MatrixNeoKozak wants to merge 1 commit into
wheresrhys:mainfrom
MatrixNeoKozak:scout-improvement-1780257176946

Conversation

@MatrixNeoKozak

Copy link
Copy Markdown

The route method in FetchMock.ts has overloaded signatures that accept either a single UserRouteConfig/RouteConfigWrapper argument or three arguments (matcher, response, options). The third parameter options is typed as UserRouteConfig | RouteConfigWrapper | string, which matches the provided argument types. However, the implementation uses @ts-expect-error comments to suppress TypeScript errors when calling this.route(...) from shorthand methods. This change removes the @ts-expect-error comments and adjusts the overloaded implementation signature to be more precise, ensuring that TypeScript can correctly type-check the internal calls. The fix aligns the implementation with the declared overloads and improves type safety without altering runtime behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant