10BC0 fix: Use `export =` in TypeScript definitions by jordanbtucker · Pull Request #1285 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content
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
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