Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start app in osschat, Types have separate declarations of a private property 'options'. #7

Closed
hailiang-wang opened this issue Oct 4, 2021 · 3 comments

Comments

@hailiang-wang
Copy link
Member

$ npm run build && DEBUG=wechaty:chatopera* node dist/bin/main.js

> [email protected] build
> tsc

src/setup-bot.ts:85:7 - error TS2345: Argument of type 'import("/c/ada/git/wechaty-chatopera/node_modules/wechaty/dist/src/plugin").WechatyPlugin' is not assig
nable to parameter of type 'import("/c/ada/git/osschat/node_modules/wechaty/dist/esm/src/plugin").WechatyPlugin'.
  Types of parameters 'bot' and 'bot' are incompatible.
    Type 'import("/c/ada/git/osschat/node_modules/wechaty/dist/esm/src/wechaty").Wechaty' is not assignable to type 'import("/c/ada/git/wechaty-chatopera/node_
modules/wechaty/dist/src/wechaty").Wechaty'.
      Types have separate declarations of a private property 'options'.

 85       WechatyChatopera({
          ~~~~~~~~~~~~~~~~~~
 86         mention: false,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
...
 92         faqSuggReplyThreshold: process.env["CHATOPERA_FAQ_SUGGREPLY_THRES"] ? parseFloat(process.env['CHATOPERA_FAQ_SUGGREPLY_THRES']): undefined,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 93       })
    ~~~~~~~~


Found 1 error.

@hailiang-wang
Copy link
Member Author

Errors happens when using with npm link.

Reproduce:

  1. run npm link in wechaty-chatopera dev folder

  2. cd osschat project, and run npm link wechaty-chatopera

  3. start osschat, with npm run build && DEBUG=wechaty:chatopera* node dist/bin/main.js

Then, it fails with above error.

@huan
Copy link
Member

huan commented Oct 4, 2021

This is highly like ESM/CJS module mismatch problem.

My suggestion would be to convert this repo from CJS to ESM, how do you think about it?

See:

@hailiang-wang
Copy link
Member Author

The linked module is also compiled into ESM with npm run dist.
Get along with work around now, to modify the dist file under osschat/node_module directly, just for debug purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants