E5EF Fix typings by cranesandcaff · Pull Request #587 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
19 changes: 12 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ declare function feathers(): feathers.Application;

declare namespace feathers {
export var static: typeof express.static;

type NullableId = number | string | null;

interface Params {
query?: any;
}

interface Pagination <T> {
total: Number,
limit: Number,
Expand All @@ -34,13 +34,13 @@ declare namespace feathers {
get?(id: number | string, params?: Params, callback?: any): Promise<T>;

/**
* Creates a new resource with data.
* Creates a new resource with data.
*/
create?(data: T | T[], params?: Params, callback?: any): Promise<T | T[]>;

/**
* Replaces the resource identified by id with data.
* Update multiples resources with id equal `null`
* Update multiples resources with id equal `null`
*/
update?(id: NullableId, data: T, params?: Params, callback?: any): Promise<T>;

Expand All @@ -58,9 +58,14 @@ declare namespace feathers {
remove?(id: NullableId, params?: Params, callback?: any): Promise<T>;

/**
* Initialize your service with any special configuration or if connecting services that are very tightly coupled
* Initialize your service with any special configuration or if connecting services that are very tightly coupled
*/
setup?(app?: Application, path?: string): void;

before(any?): this;
after(any?): this;
filter(any?): this;

}

interface FeathersUseHandler<T> extends expressCore.IRouterHandler<T>, express.IRouterMatcher<T> {
Expand All @@ -74,7 +79,7 @@ declare namespace feathers {
service<T>(location: string): Service<T>;

/**
* Registers a new service for that path and returns the wrapped service object
* Registers a new service for that path and returns the wrapped service object
*/
service<T>(location: string, service: Service<T>, options?: any): Service<T>;

Expand All @@ -84,7 +89,7 @@ declare namespace feathers {
setup(): this;

/**
* Register a service object
* Register a service object
*/
use: FeathersUseHandler<this>;
}
Expand Down
0