lichess-org / chessground

Mobile/Web chess UI for lichess.org
https://lichess.org
GNU General Public License v3.0
1.02k stars 262 forks source link

Legal moves React error #210

Closed victorocna closed 2 years ago

victorocna commented 2 years ago

Hello everyone!

I am implementing a chessboard "legal moves only" in React and I noticed that after chessground version 7.6.13 it stopped working. For your convenience I made 2 codesandbox demo repos where you can see the problem:

The React implementation relies on this function found in the examples repo.

Cheers! Victor

niklasf commented 2 years ago

Hi, sorry, arguably this should have been a major version update. The issue becomes obvious when using types.

It's now:

export type Dests = Map<Key, Key[]>;

So it should be:

const dests = new Map();
// [...]
dests.set(s, ms.map((m) => m.to));
victorocna commented 2 years ago

Thanks for the explanation, I confirm that it works now for the latest package release. :+1: