Skip to content

Commit

Permalink
fix: Use export = in TypeScript definitions (#1285)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbtucker authored and daffl committed May 14, 2019
1 parent 9abf314 commit 12d0f4b
Show file tree
Hide file tree
Showing 11 changed files with 340 additions and 321 deletions.
26 changes: 26 additions & 0 deletions packages/client/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import feathers from '@feathersjs/feathers';
import authentication from '@feathersjs/authentication-client';
import errors from '@feathersjs/errors';
import primus from '@feathersjs/primus-client';
import rest from '@feathersjs/rest-client';
import socketio from '@feathersjs/socketio-client';

export as namespace feathers;

declare const feathersClient: FeathersClient;
export = feathersClient;

type Feathers = typeof feathers;
type FeathersAuthenticationClient = typeof authentication;
type FeathersErrors = typeof errors;
type FeathersPrimusClient = typeof primus;
type FeathersRestClient = typeof rest;
type FeathersSocketIOClient = typeof socketio;

interface FeathersClient extends Feathers {
authentication: FeathersAuthenticationClient;
errors: FeathersErrors;
primus: FeathersPrimusClient;
rest: FeathersRestClient;
socketio: FeathersSocketIOClient;
}
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"node": ">= 6"
},
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"clean": "../../node_modules/.bin/shx rm -rf dist/ && ../../node_modules/.bin/shx mkdir -p dist",
"version": "npm run build",
Expand Down
7 changes: 0 additions & 7 deletions packages/errors/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
// Type definitions for @feathersjs/errors 3.3
// Project: https://feathersjs.com
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// RazzM13 <https://github.com/RazzM13>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.2

export interface FeathersErrorJSON {
readonly name: string;
readonly message: string;
Expand Down
94 changes: 37 additions & 57 deletions packages/express/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,38 @@
// Type definitions for @feathersjs/express 1.1
// Project: https://feathersjs.com
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Aleksey Klimenko <https://github.com/DadUndead>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3

import { Application as FeathersApplication } from '@feathersjs/feathers';
import * as express from 'express';

declare const feathersExpress: (<T>(app: FeathersApplication<T>) => Application<T>);
export default feathersExpress;
export type Application<T = any> = express.Application & FeathersApplication<T>;

export function errorHandler (options?: {
public?: string,
logger?: { error?: (msg: string) => void }|null,
html?: any,
json?: any
}): express.ErrorRequestHandler;
export function notFound (): express.RequestHandler;

export const rest: {
(handler?: express.RequestHandler): () => void;
formatter: express.RequestHandler;
};

/*
* Re-export of the express package.
**/

export {
CookieOptions,
Errback,
ErrorRequestHandler,
Express,
Handler,
IRoute,
IRouter,
IRouterHandler,
IRouterMatcher,
json,
MediaType,
NextFunction,
Request,
RequestHandler,
RequestParamHandler,
Response,
Router,
RouterOptions,
Send,
static,
urlencoded
} from 'express';

export function parseAuthentication (...strategies: string[]): express.RequestHandler;
export function authenticate (...strategies: string[]): express.RequestHandler;
export const original: () => express.Application;
import express from 'express';

declare const feathersExpress: FeathersExpress;
export = feathersExpress;

type Express = typeof express;

interface FeathersExpress extends Express {
<T>(app: FeathersApplication<T>): feathersExpress.Application<T>;

(app?: any): express.Express;

default: FeathersExpress;

rest: {
(handler?: express.RequestHandler): () => void;
formatter: express.RequestHandler;
};

original: Express;

errorHandler (options?: {
public?: string,
logger?: { error?: (msg: string) => void | null },
html?: any,
json?: any
}): express.ErrorRequestHandler;

notFound (): express.RequestHandler;

parseAuthentication (...strategies: string[]): express.RequestHandler;
authenticate (...strategies: string[]): express.RequestHandler;
}

declare namespace feathersExpress {
type Application<T = any> = express.Express & FeathersApplication<T>;
}
Loading

0 comments on commit 12d0f4b

Please sign in to comment.