Replace interfaces with types (I am not sure why types work better than interfaces)
sed -Ei ''"s/export interface ([a-zA-Z]*)/export type \1 =/" src/apiDefinition.ts
Usage
importtype{AxiosResponse}from'axios';import{ApiInterfaceGenerator}from'openapi-typescript-client-interface';// import type 'paths' from file generated using openapi-typescriptimport{paths}from'./apiDefinition';// let the library compute interface by pathstypeApiInterface=ApiInterfaceGenerator<paths>// implement the interface (this could also be done using es6 Proxy dynamicaly however Proxy is not correctly typed in TS yet)constapi: ApiInterface={'/': {get: (): Promise<AxiosResponse<{pageTitle: string}>>=>{returnaxios.get('/')},},}// TS can determine available methods under each route, parameters, body and even response type// only reject type can't be infered because TS can't handle it right now https://stackoverflow.com/a/50071254/3265676api['/'].get().then(({ pageTitle })=>{console.log(pageTitle);})