diff --git a/README.md b/README.md index 8ea98f92..e4551089 100644 --- a/README.md +++ b/README.md @@ -441,6 +441,16 @@ npm install node-fetch --save-dev npm install form-data --save-dev ``` +In order to compile the project and resolve the imports, you will need to enable the `allowSyntheticDefaultImports` +in your `tsconfig.json` file. + +```json +{ + "allowSyntheticDefaultImports": true +} +``` + + [npm-url]: https://npmjs.org/package/openapi-typescript-codegen [npm-image]: https://img.shields.io/npm/v/openapi-typescript-codegen.svg [license-url]: LICENSE diff --git a/src/templates/core/node/request.hbs b/src/templates/core/node/request.hbs index 8d916521..ee5e3338 100644 --- a/src/templates/core/node/request.hbs +++ b/src/templates/core/node/request.hbs @@ -1,6 +1,6 @@ {{>header}} -import * as FormData from 'form-data'; +import FormData from 'form-data'; import fetch, { BodyInit, Headers, RequestInit, Response } from 'node-fetch'; import { types } from 'util'; diff --git a/test/e2e/scripts/compileWithTypescript.js b/test/e2e/scripts/compileWithTypescript.js index 0987ad71..8c9969cc 100644 --- a/test/e2e/scripts/compileWithTypescript.js +++ b/test/e2e/scripts/compileWithTypescript.js @@ -12,6 +12,16 @@ function compileWithTypescript(dir) { module: 'es6', moduleResolution: 'node', lib: ['es6', 'es2017', 'dom'], + declaration: false, + declarationMap: false, + sourceMap: false, + noImplicitReturns: true, + noImplicitThis: true, + noImplicitAny: true, + strict: true, + strictNullChecks: true, + strictFunctionTypes: true, + allowSyntheticDefaultImports: true, }, include: ['./index.ts'], }; diff --git a/tsconfig.json b/tsconfig.json index a3bb634d..f5e80d1d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,8 @@ "noImplicitAny": true, "strict": true, "strictNullChecks": true, - "strictFunctionTypes": true + "strictFunctionTypes": true, + "allowSyntheticDefaultImports": true }, "files": [