steelbrain / steelbrain/node-ssh
Module '"stream"' can only be default-imported using the 'esModuleInterop' flag
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Description
When compiling with typescript 4.8.3 (at this time latest version), I am getting this error:
node_modules/node-ssh/lib/typings/index.d.ts:2:8 - error TS1259: Module '"stream"' can only be default-imported using the 'esModuleInterop' flag
2 import stream from 'stream';
~~~~~~node_modules/@types/node/stream.d.ts:333:5
333 export = internal;
~~~~~~~~~~~~~~~~~~
This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
When setting esModuleInterop to true, typescript renders other used libraries properties with getters only e.g.:
prompt.message = '';
^TypeError: Cannot set property message of # which has only a getter
at Object. (/home/cj/auto-config/auto-config-init.js:161:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47Workaround: Editing file node_modules/node-ssh/lib/typings/index.d.ts so the line at the begining:
import stream from 'stream';to be:
import * as stream from 'stream';
solves issue for me without esModuleInterop flag set.Can you please add this change in the next version?
Thank you in advance CJ
Contributor guide
No contributing guide indexed for this repository
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
The reported declaration is node-ssh/lib/typings/index.d.ts; start by checking its stream import under TypeScript 4.8.3 without esModuleInterop. Verify that the package type-checks and existing runtime usage still works without requiring consumers to enable esModuleInterop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100