Has anyone successfully used the Swagger Code Generator to create a TypeScript Fetch client that can be used within the browser? I'm trying to use the generated API client within a React application that uses TypeScript.
Although I've successfully generated a client (i.e. the api.ts file), I'm getting hung up on the fact that it begins with the following imports:
import * as querystring from "querystring";
import * as url from "url";
import * as isomorphicFetch from "isomorphic-fetch";
import * as assign from "core-js/library/fn/object/assign";
interface Dictionary<T> { [index: string]: T; }
export interface FetchAPI { (url: string, init?: any): Promise<any>; }
...
While I can successfully find the TypeScript typings (i.e. @types) for isomorphic-fetch and core-js, I can't find typings for querystring and url. As a result, I'm getting [ts] Cannot find module...
for the querystring
, url
and also the assign
imports.
Is this client not actually intended to be used within the browser? Otherwise, can anyone provide any suggestions for what I might be doing wrong here?
Thanks in advance for any help!