chess.js icon indicating copy to clipboard operation
chess.js copied to clipboard

Move with promotion fails on the typescript (dev) branch

Open rafalou38 opened this issue 1 year ago • 2 comments

I want to set the promotion to "q" as a default but when I run this code on a move not resulting in a promotion

this.chessInstance.move({
  from: ...,
  to: ...,
  promotion: "q",
});

It works on the master branch but not on the dev branch, Is it made on purpose ?

I used the debugger and noticed that the issue comes from here (move function):

(!('promotion' in moves[i]) || move.promotion === moves[i].promotion)) {

in the master branch, moves[i].promotion does not exist in the dev branch , moves[i].promotion is undefined

rafalou38 avatar Aug 19 '22 14:08 rafalou38

Thanks for the report @rafalou38. I'm trying to understand this issue more clearly. Are you providing { promotion: 'q' } even when the move is not a promotion?

jhlywa avatar Sep 05 '22 19:09 jhlywa

Yes, for all the moves.

rafalou38 avatar Sep 05 '22 19:09 rafalou38

This should be fixed on the dev branch. Thanks again for the report.

jhlywa avatar Sep 17 '22 20:09 jhlywa