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

get() method of Chess class returns false instead null #427

Open
GienKu opened this issue Jul 16, 2023 · 2 comments
Open

get() method of Chess class returns false instead null #427

GienKu opened this issue Jul 16, 2023 · 2 comments

Comments

@GienKu
Copy link

GienKu commented Jul 16, 2023

Hello, I'm a beginner programmer, and I have encountered a problem as described in the title. I have also checked the implementation, which is as follows:
get(square: Square) { return this._board[Ox88[square]] || false }
Should it be like this?
console.log(game.get('a6')); // prints false

@jhlywa
Copy link
Owner

jhlywa commented Jul 16, 2023

Hi @GienKu. Welcome to programming and thanks for the report!

It looks like you found a typo in the code that has been there for over a year. Looking at it with fresh eyes (and with TypeScript) in mind, it may be more idiomatic for get to return a Piece | undefined. I'm going to leave this open for a few days while I decide on what to do.

Thanks!

@michelsafi
Copy link

hello. any update on this issue

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

No branches or pull requests

3 participants