Switched request and response generics position (#1132)

* Updated code generation

* Switched request and response generics position

* Updated test

* API generation

* Removed unused generics

* Test type definitions for callback style API as well

* Fix comments

* Fix conflict

* API generation

* Updated type def
This commit is contained in:
Tomas Della Vedova
2020-04-06 12:45:27 +02:00
committed by GitHub
parent e67b55d163
commit 6779f3b11a
10 changed files with 2636 additions and 2339 deletions

9
lib/Transport.d.ts vendored
View File

@ -45,7 +45,7 @@ interface TransportOptions {
opaqueIdPrefix?: string;
}
export interface RequestEvent<TResponse = ResponseBody, TContext = unknown> {
export interface RequestEvent<TResponse = Record<string, any>, TContext = unknown> {
body: TResponse;
statusCode: number | null;
headers: Record<string, any> | null;
@ -70,11 +70,10 @@ export interface RequestEvent<TResponse = ResponseBody, TContext = unknown> {
// ApiResponse and RequestEvent are the same thing
// we are doing this for have more clear names
export interface ApiResponse<TResponse = ResponseBody, TContext = unknown> extends RequestEvent<TResponse, TContext> {}
export interface ApiResponse<TResponse = Record<string, any>, TContext = unknown> extends RequestEvent<TResponse, TContext> {}
export type RequestBody<T = Record<string, any>> = T | string | Buffer | ReadableStream
export type RequestNDBody<T = Record<string, any>[]> = T | string[] | Buffer | ReadableStream
export type ResponseBody<T = Record<string, any>> = T | string | boolean | ReadableStream
export type RequestBody<T = Record<string, any>> = T | string | Buffer | ReadableStream
export type RequestNDBody<T = Record<string, any>[]> = T | string | string[] | Buffer | ReadableStream
export interface TransportRequestParams {
method: string;