ezolenko / rollup-plugin-typescript2

Rollup plugin for typescript with compiler errors.
MIT License
822 stars 71 forks source link

TSDX: `import yargs from 'yargs'` error "has no call signatures" #467

Closed Yueyanc closed 10 months ago

Yueyanc commented 10 months ago

Troubleshooting

  1. Does tsc have the same output? If so, please explain why this is incorrect behavior

  2. Does your Rollup plugin order match this plugin's compatibility? If not, please elaborate

  3. Can you create a minimal example that reproduces this behavior? Preferably, use this environment for your reproduction

here! https://stackblitz.com/github/Yueyanc/README-i18n?file=README.md

What happens and why it is incorrect

throw error:

Type 'typeof import("F:/project/README-i18n/node_modules/@types/yargs/index")' has no call signatures.

more rollup detail config will print by tsdx.config.js

Environment

Versions


rollup-plugin-typescript2@0.27.3
rollup@1.32.1
typescript@3.9.10

rollup.config.js

:
```js ```

tsconfig.json

:
```json5 ```

package.json

:
```json ```

plugin output with verbosity 3

:
```text ```
Yueyanc commented 10 months ago

Maybe tsdx has a incorrect version 3.9.10?

agilgur5 commented 10 months ago

Please fill out the issue template in its entirety, it is there for a reason.

Maybe tsdx has a incorrect version 3.9.10?

TSDX has not had a release since 2020, it is unmaintained and has been for years. I was the longest solo maintainer of TSDX, that last release is by me, and I quit after experiencing too much abuse and toxicity in return for volunteering 1000s of hours of my time, particularly by the creator.

Since it's unmaintained, it also has an old version of rpt2.

In any case, this repo is for rollup-plugin-typescript2, not TSDX. rpt2 cannot change TSDX's versions or configuration. A minimal, reproducible bug report would have to be filed using rpt2 itself, not TSDX, and fill out the issue template in its entirety.

agilgur5 commented 10 months ago
Type 'typeof import("F:/project/README-i18n/node_modules/@types/yargs/index")' has no call signatures.

Based on your error and similar errors like #455, I'm guessing this is probably an import error.

You have import yargs from 'yargs' in ESM, but yargs uses CJS and so has no default export. You might want to use a namespace import like import * as yargs from 'yargs' or check your esModuleInterop config.

In either case, that's not an rpt2 error, tsc will give you the same error.

Yueyanc commented 10 months ago

Please fill out the issue(问题) template(模板) in its entirety(整体), it is there for a reason.

Maybe tsdx has a incorrect version(版本) 3.9.10?

TSDX has not had a release since 2020, it is unmaintained([网络] 服务接口与内部的) and has been for years. I was the longest solo maintainer(保持) of TSDX, that last release is by me, and I quit after experiencing too much abuse and toxicity(毒性) in return for volunteering 1000s of hours of my time, particularly by the creator(造物主).

Since it's unmaintained([网络] 服务接口与内部的), it also has an old version(版本) of rpt2.

In any case, this repo(回购) is for rollup-plugin-typescript2, not TSDX. rpt2 cannot change TSDX's versions(版本) or configuration(配置). A minimal(最小), reproducible(重现) bug report would have to be filed(提起) using rpt2 itself, not TSDX, and fill out the issue(问题) template(模板) in its entirety(整体).

thinks for your contributions to open source,I will switch to tsup,I think the issue was caused by old ts verison, not rpt2.

Yueyanc commented 10 months ago
Type 'typeof import("F:/project/README-i18n/node_modules/@types/yargs/index")' has no call signatures.

Based on your error(误差) and similar errors(误差) like #455, I'm guessing this is probably an import(进口) error(误差).

You have import yargs from 'yargs' in ESM, but yargs uses CJS and so has no default(默认) export. You might want to use a namespace([计]命名空间) import(进口) like import * as yargs from 'yargs' or check your esModuleInterop config([计] 显示配置信息命令).

In either case, that's not an rpt2 error(误差), tsc will give you the same error(误差).

import yargs from 'yargs' not resolve this issue ,Perhaps the cause of this problem is that the version below ts4.5 is not support .d.ms?