TSError: ⨯ Unable to compile TypeScript:
Created by: gracetong0630
Hi, I have been trying to installing the Wechaty bots for days. After trying over dozens of times, I have encountered this issue. Could you please help? Thank you very much!
MacBook:wechaty-getting-started Grace$ docker run -ti --volume="$(pwd)":/bot --rm zixia/wechaty mybot.ts
__ __ _ _
\ \ / /__ ___| |__ __ _| |_ _ _
\ \ /\ / / _ \/ __| '_ \ / _` | __| | | |
\ V V / __/ (__| | | | (_| | |_| |_| |
\_/\_/ \___|\___|_| |_|\__,_|\__|\__, |
|___/
____________________________________________________
https://www.chatie.io
____ _ _
/ ___|___ _ __ _ __ ___ ___| |_(_)_ __ __ _
| | / _ \| '_ \| '_ \ / _ \/ __| __| | '_ \ / _` |
| |__| (_) | | | | | | | __/ (__| |_| | | | | (_| |
\____\___/|_| |_|_| |_|\___|\___|\__|_|_| |_|\__, |
|___/
____ _ _ ____ _
/ ___| |__ __ _| |_| __ ) ___ | |_ ___
| | | '_ \ / _` | __| _ \ / _ \| __/ __|
| |___| | | | (_| | |_| |_) | (_) | |_\__ \
\____|_| |_|\__,_|\__|____/ \___/ \__|___/
WECHATY Environment Variables: 1
WECHATY_DOCKER=1
Starting Docker Container for Wechaty v0.27.13 with Node.js v10.16.0 ...
Working directory: /bot
Please make sure you had installed all the NPM modules which is depended on your bot script.
Executing ts-node --type-check mybot.ts
/wechaty/node_modules/ts-node/src/index.ts:243
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
mybot.ts:17:5 - error TS2345: Argument of type '"friend"' is not assignable to parameter of type 'never'.
17 .on('friend', async function (contact, request){
~~~~~~~~
mybot.ts:17:31 - error TS7006: Parameter 'contact' implicitly has an 'any' type.
17 .on('friend', async function (contact, request){
~~~~~~~
mybot.ts:17:40 - error TS7006: Parameter 'request' implicitly has an 'any' type.
17 .on('friend', async function (contact, request){
~~~~~~~
mybot.ts:24:31 - error TS7006: Parameter 'm' implicitly has an 'any' type.
24 .on('message', async function(m){
~
at createTSError (/wechaty/node_modules/ts-node/src/index.ts:243:12)
at reportTSError (/wechaty/node_modules/ts-node/src/index.ts:247:19)
at getOutput (/wechaty/node_modules/ts-node/src/index.ts:360:34)
at Object.compile (/wechaty/node_modules/ts-node/src/index.ts:393:11)
at Module.m._compile (/wechaty/node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Object.require.extensions.(anonymous function) [as .ts] (/wechaty/node_modules/ts-node/src/index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
ERROR: Bot exited with code 1