Skip to content

Commit 12d0f4b

Browse files
jordanbtuckerdaffl
authored andcommitted
fix: Use export = in TypeScript definitions (#1285)
1 parent 9abf314 commit 12d0f4b

File tree

11 files changed

+340
-321
lines changed

11 files changed

+340
-321
lines changed

packages/client/index.d.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import feathers from '@feathersjs/feathers';
2+
import authentication from '@feathersjs/authentication-client';
3+
import errors from '@feathersjs/errors';
4+
import primus from '@feathersjs/primus-client';
5+
import rest from '@feathersjs/rest-client';
6+
import socketio from '@feathersjs/socketio-client';
7+
8+
export as namespace feathers;
9+
10+
declare const feathersClient: FeathersClient;
11+
export = feathersClient;
12+
13+
type Feathers = typeof feathers;
14+
type FeathersAuthenticationClient = typeof authentication;
15+
type FeathersErrors = typeof errors;
16+
type FeathersPrimusClient = typeof primus;
17+
type FeathersRestClient = typeof rest;
18+
type FeathersSocketIOClient = typeof socketio;
19+
20+
interface FeathersClient extends Feathers {
21+
authentication: FeathersAuthenticationClient;
22+
errors: FeathersErrors;
23+
primus: FeathersPrimusClient;
24+
rest: FeathersRestClient;
25+
socketio: FeathersSocketIOClient;
26+
}

packages/client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"node": ">= 6"
2121
},
2222
"main": "index.js",
23+
"types": "index.d.ts",
2324
"scripts": {
2425
"clean": "../../node_modules/.bin/shx rm -rf dist/ && ../../node_modules/.bin/shx mkdir -p dist",
2526
"version": "npm run build",

packages/errors/index.d.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
// Type definitions for @feathersjs/errors 3.3
2-
// Project: https://feathersjs.com
3-
// Definitions by: Jan Lohage <https://github.com/j2L4e>
4-
// RazzM13 <https://github.com/RazzM13>
5-
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
6-
// TypeScript Version: 2.2
7-
81
export interface FeathersErrorJSON {
92
readonly name: string;
103
readonly message: string;

packages/express/index.d.ts

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,38 @@
1-
// Type definitions for @feathersjs/express 1.1
2-
// Project: https://feathersjs.com
3-
// Definitions by: Jan Lohage <https://github.com/j2L4e>
4-
// Aleksey Klimenko <https://github.com/DadUndead>
5-
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
6-
// TypeScript Version: 2.3
7-
81
import { Application as FeathersApplication } from '@feathersjs/feathers';
9-
import * as express from 'express';
10-
11-
declare const feathersExpress: (<T>(app: FeathersApplication<T>) => Application<T>);
12-
export default feathersExpress;
13-
export type Application<T = any> = express.Application & FeathersApplication<T>;
14-
15-
export function errorHandler (options?: {
16-
public?: string,
17-
logger?: { error?: (msg: string) => void }|null,
18-
html?: any,
19-
json?: any
20-
}): express.ErrorRequestHandler;
21-
export function notFound (): express.RequestHandler;
22-
23-
export const rest: {
24-
(handler?: express.RequestHandler): () => void;
25-
formatter: express.RequestHandler;
26-
};
27-
28-
/*
29-
* Re-export of the express package.
30-
**/
31-
32-
export {
33-
CookieOptions,
34-
Errback,
35-
ErrorRequestHandler,
36-
Express,
37-
Handler,
38-
IRoute,
39-
IRouter,
40-
IRouterHandler,
41-
IRouterMatcher,
42-
json,
43-
MediaType,
44-
NextFunction,
45-
Request,
46-
RequestHandler,
47-
RequestParamHandler,
48-
Response,
49-
Router,
50-
RouterOptions,
51-
Send,
52-
static,
53-
urlencoded
54-
} from 'express';
55-
56-
export function parseAuthentication (...strategies: string[]): express.RequestHandler;
57-
export function authenticate (...strategies: string[]): express.RequestHandler;
58-
export const original: () => express.Application;
2+
import express from 'express';
3+
4+
declare const feathersExpress: FeathersExpress;
5+
export = feathersExpress;
6+
7+
type Express = typeof express;
8+
9+
interface FeathersExpress extends Express {
10+
<T>(app: FeathersApplication<T>): feathersExpress.Application<T>;
11+
12+
(app?: any): express.Express;
13+
14+
default: FeathersExpress;
15+
16+
rest: {
17+
(handler?: express.RequestHandler): () => void;
18+
formatter: express.RequestHandler;
19+
};
20+
21+
original: Express;
22+
23+
errorHandler (options?: {
24+
public?: string,
25+
logger?: { error?: (msg: string) => void | null },
26+
html?: any,
27+
json?: any
28+
}): express.ErrorRequestHandler;
29+
30+
notFound (): express.RequestHandler;
31+
32+
parseAuthentication (...strategies: string[]): express.RequestHandler;
33+
authenticate (...strategies: string[]): express.RequestHandler;
34+
}
35+
36+
declare namespace feathersExpress {
37+
type Application<T = any> = express.Express & FeathersApplication<T>;
38+
}

0 commit comments

Comments
 (0)