Improve typings (#813)
The ApiResponse now accepts a generics that defaults to any, same for every API method that might need a body.
This commit is contained in:
committed by
delvedor
parent
ef3126b361
commit
29beb44bf5
4
lib/Transport.d.ts
vendored
4
lib/Transport.d.ts
vendored
@ -49,7 +49,7 @@ interface TransportOptions {
|
||||
headers?: anyObject;
|
||||
}
|
||||
|
||||
export interface RequestEvent {
|
||||
export interface RequestEvent<T = any> {
|
||||
body: any;
|
||||
statusCode: number | null;
|
||||
headers: anyObject | null;
|
||||
@ -71,7 +71,7 @@ export interface RequestEvent {
|
||||
|
||||
// ApiResponse and RequestEvent are the same thing
|
||||
// we are doing this for have more clear names
|
||||
export interface ApiResponse extends RequestEvent {}
|
||||
export interface ApiResponse<T = any> extends RequestEvent<T> {}
|
||||
|
||||
declare type anyObject = {
|
||||
[key: string]: any;
|
||||
|
||||
Reference in New Issue
Block a user