Skip to content

Commit

Permalink
fix: Updated typings for express middleware (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
deskoh committed Mar 4, 2020
1 parent 2b30813 commit 6b8e897
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/nodejs.yml
Expand Up @@ -22,6 +22,9 @@ jobs:
- run: npm test
env:
CI: true
- run: codeclimate-test-reporter < coverage/lcov.info
- run: |
if [ "$CODECLIMATE_REPO_TOKEN" != "" ]; then
codeclimate-test-reporter < coverage/lcov.info
fi
env:
CODECLIMATE_REPO_TOKEN: ${{ secrets.codeclimate }}
12 changes: 11 additions & 1 deletion packages/express/index.d.ts
@@ -1,4 +1,4 @@
import { Application as FeathersApplication, Params as FeathersParams, HookContext } from '@feathersjs/feathers';
import { Application as FeathersApplication, Params as FeathersParams, HookContext, SetupMethod, ServiceMethods } from '@feathersjs/feathers';
import express from 'express';

declare const feathersExpress: FeathersExpress;
Expand Down Expand Up @@ -47,4 +47,14 @@ declare module 'express-serve-static-core' {
data?: any;
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;
}
}

0 comments on commit 6b8e897

Please sign in to comment.