Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type inference for request handlers #2411

Closed
jfamousket opened this issue Jul 5, 2021 · 1 comment
Closed

Wrong type inference for request handlers #2411

jfamousket opened this issue Jul 5, 2021 · 1 comment

Comments

@jfamousket
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @feathersjs/express@4.5.11 for the project I'm working on.

The request, response, and next function type of my request handlers had any type. After fiddling around I found that the changes made by this pull request were the cause of the issue.

Here is the diff that solved my problem:

diff --git a/node_modules/@feathersjs/express/index.d.ts b/node_modules/@feathersjs/express/index.d.ts
index 05d329d..f40abfa 100644
--- a/node_modules/@feathersjs/express/index.d.ts
+++ b/node_modules/@feathersjs/express/index.d.ts
@@ -48,13 +48,13 @@ declare module 'express-serve-static-core' {
         hook?: HookContext;
     }
 
-    type FeathersService = Partial<ServiceMethods<any> & SetupMethod>;
-
-    interface IRouterMatcher<T> {
-        // tslint:disable-next-line callable-types (Required for declaration merging)
-        <P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(
-            path: PathParams,
-            ...handlers: (RequestHandler<P, ResBody, ReqBody> | FeathersService | Application)[]
-        ): T;
-    }
+    // type FeathersService = Partial<ServiceMethods<any> & SetupMethod>;
+
+    // interface IRouterMatcher<T> {
+    //     // tslint:disable-next-line callable-types (Required for declaration merging)
+    //     <P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(
+    //         path: PathParams,
+    //         ...handlers: (RequestHandler<P, ResBody, ReqBody> | FeathersService | Application)[]
+    //     ): T;
+    // }
 }

This issue body was partially generated by patch-package.

@daffl
Copy link
Member

daffl commented Oct 18, 2022

This should be fixed in the latest v5 prerelease

@daffl daffl closed this as completed Oct 18, 2022
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

No branches or pull requests

2 participants