8000 Wrong type inference for request handlers · Issue #2411 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Wrong type inference for request handlers #2411

@jfamousket

Description

@jfamousket

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0