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

npx tsc error TS2345 #120

Closed
Vance0124 opened this issue Aug 20, 2023 · 5 comments · May be fixed by #131
Closed

npx tsc error TS2345 #120

Vance0124 opened this issue Aug 20, 2023 · 5 comments · May be fixed by #131

Comments

@Vance0124
Copy link

When I run the command:

npx tsc

It runs wrong with the errors:

src/BlockVeins.ts:25:32 - error TS2345: Argument of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/mineflayer/node_modules/prismarine-block/index").Block' is not assignable to parameter of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/prismarine-block/index").Block'.
  The types returned by 'getProperties()' are incompatible between these types.
    Type '{ [key: string]: string | number | boolean; }' is not assignable to type '{ [key: string]: string | number; }'.
      'string' index signatures are incompatible.
        Type 'string | number | boolean' is not assignable to type 'string | number'.
          Type 'boolean' is not assignable to type 'string | number'.

25           if (targets.includes(neighbor)) continue
                                  ~~~~~~~~

src/BlockVeins.ts:26:29 - error TS2345: Argument of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/mineflayer/node_modules/prismarine-block/index").Block' is not assignable to parameter of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/prismarine-block/index").Block'.

26           if (open.includes(neighbor)) continue
                               ~~~~~~~~

src/BlockVeins.ts:28:21 - error TS2345: Argument of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/mineflayer/node_modules/prismarine-block/index").Block' is not assignable to parameter of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/prismarine-block/index").Block'.

28           open.push(neighbor)
                       ~~~~~~~~

src/CollectBlock.ts:209:23 - error TS2345: Argument of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/prismarine-block/index").Block' is not assignable to parameter of type 'import("E:/PythonProject/server/Voyager/voyager/env/mineflayer/node_modules/mineflayer/node_modules/prismarine-block/index").Block'.
  Type 'Block' is missing the following properties from type 'Block': setSignText, getSignText

209         await bot.dig(block);
                          ~~~~~


Found 4 errors in 2 files.

Errors  Files
     3  src/BlockVeins.ts:25
     1  src/CollectBlock.ts:209

How can I fix it? Please tell me, thanks.

@XueFuzhao
Copy link

Hi, did you fix this problem? I encountered the same issue.

@Foxy6670
Copy link

I'm having this issue, too.

@xieleo5
Copy link
Collaborator

xieleo5 commented Aug 27, 2023

This may be caused by a different version of node js. I personally used these versions to run all experiments:

$ node -v
v16.13.0
$ npm -v
9.6.2
$ npx tsc -v
Version 5.0.2

@Vance0124
Copy link
Author

Hi, did you fix this problem? I encountered the same issue.

@Foxy6670 @Foxy6670 This is due to a version issue with prismarine-block (try npm show prismarine-block, It will display 1.17.1 or some other version but should be 1.16.3 ). For me, I switched the path location to the voyager/env/mineflayer/node_modules/mineflayer/node_modules/ and voyager/env/mineflayer/node_modules/, and used the following commands:
npm uninstall prismarine-block
npm install prismarine-block@1.16.3

The preceding commands need to be executed on both paths.

@jordanbtucker
Copy link

Alternatively, cd into mineflayer-collectblock and run npm install.

Here are better steps derived from the README.

cd voyager/env/mineflayer/mineflayer-collectblock
npm install
npx tsc
cd ..
npm install

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

Successfully merging a pull request may close this issue.

5 participants