You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some code generated by Swagger Codegen, and I'm trying to publish it as an npm package with both JavaScript and TypeScript support. I had all of my ts-jest tests passing before I had created a tsconfig.json file, but when I added one, I started getting errors.
The big error is actually pointing to the file under test, saying TypeError: f is not a function:
MyServiceApi
✕ getThing (4 ms)
● MyServiceApi › getThing
TypeError: f is not a function
536 | return (f: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
537 | // @ts-ignore
> 538 | return f(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
| ^
539 | if (response.status >= 200 && response.status < 300) {
540 | return response.json();
541 | } else {
at api.ts:538:24
at MyServiceApi.getThing (api.ts:585:76)
at Object.<anonymous> (api_test.spec.ts:38:28)
The definition of the FetchAPI interface looks right, and tsc is perfectly happy:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have some code generated by Swagger Codegen, and I'm trying to publish it as an npm package with both JavaScript and TypeScript support. I had all of my ts-jest tests passing before I had created a tsconfig.json file, but when I added one, I started getting errors.
The big error is actually pointing to the file under test, saying
TypeError: f is not a function
:The definition of the
FetchAPI
interface looks right, andtsc
is perfectly happy:I had to change some imports when adding the tsconfig, so I thought that could be it, but none of the changes have made any difference on this error.
What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions