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

fix: Updated typings for express middleware #1839

Merged
merged 3 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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;
}
}