Skip to content

Argument of type 'Contact' is not assignable to parameter of type 'Contact'. #96

@lijiarui

Description

@lijiarui

Now I can import FriendRequest successfully, while when I use function FriendRequest.send(contact,content) ,it occurs error:

Argument of type 'Contact' is not assignable to parameter of type 'Contact'.

Paste the full output logs here with WECHATY_LOG=silly set

/wechaty/node_modules/ts-node/dist/index.js:160
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset));
^
TSError: ⨯ Unable to compile TypeScript
test.ts (24,20): Argument of type 'Contact' is not assignable to parameter of type 'Contact'.
Types have separate declarations of a private property 'obj'. (2345)


| __ )| | | |/ | | _ | | _ \ / _ | _ _ |
| _ | | | | | _ | |
) | | | |) | | | | |
) || |
| |
) | |
| | |
| | | _ <| |
| /| || | _ < | |
|
___/ _
/ _| || __|| ___/|| _|_|

Press ENTER to continue ...

1. source code of test.ts

import {
Wechaty
//,FriendRequest
} from 'wechaty'

import {FriendRequest} from 'wechaty/src/puppet-web/friend-request'

const bot = Wechaty.instance({profile:'test'})

bot
.on('scan' ,(url,code)=>{console.log(url)})

.on('login',username=>{
console.log(username.name())

})
.on('message', m=> {
const room = m.room()
const from = m.from()
if(room){
if(from.stranger()){
var request = new FriendRequest()
request.send(from, 'hello~')
}

}
})
.init()

2. directory structor of /bot

total 6512
-rw-r--r-- 1 root root 410 Nov 14 14:58 a.ts
-rw------- 1 root root 9564160 Nov 14 13:18 core
drwxr-xr-x 3 root root 4096 Nov 14 05:39 git
drwxr-xr-x 5 root root 4096 Nov 14 14:59 node_modules
-rw-r--r-- 1 root root 975 Nov 14 15:00 npm-debug.log
-rw-r--r-- 1 root root 494 Nov 15 13:40 test.ts
-rw-r--r-- 1 root root 1540 Nov 14 14:18 test.wechaty.json
-rw-r--r-- 1 root root 1012 Nov 15 13:39 test2.ts
-rw-r--r-- 1 root root 1371 Nov 6 11:28 wechatyshow.ts

3. package.json

cat: /bot/package.json: No such file or directory
No package.json

4. directory structor inside /bot/node_modules

@types qrcode-terminal wechaty

5. wechaty doctor

Wechaty Doctor

  1. Wechaty version: 0.6.22
  2. Linux x64 version 3.16.0-4-amd64 memory 402/1000 MB
  3. Docker: true
  4. Node version: v7.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions