swagger-api / swagger-api/swagger-codegen
Typescript node code generation (import/require TS1202)
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
The code generated has
import localVarRequest = require('request');
import http = require('http');
import Promise = require('bluebird');
This type of syntax runs into the error. Does a certain source/target setting on TS get around this problem?
''' error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
'''
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No template or test file is named. Start by locating the TypeScript generation templates that emit the reported import assignments, then reproduce TS1202 with the generated output and its compiler settings. Done means the generated TypeScript avoids the reported error under the intended module target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100