Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jan 19, 2024

This is going to be useful for LeelaKnightOdds and LeelaQueenForKnight. 🙂

@Naphthalin
Copy link

Thanks for that addition! Allowing to challenge either of the piece odds bots directly via a link already containing the suitable positions would make things a lot more convenient, especially for new challengers.

let friendUser: string;
const forceOptions: ForceSetupOptions = {};
const urlParams = new URLSearchParams(location.search);
const friendUser = urlParams.get('user') ?? undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is adding ?? undefined necessary here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.get(...) returns null when the parameter is not found (i.e. string | null), but the friendUser argument of openModal a few lines below accepts string | undefined, so the null value has to be converted to undefined.

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 this pull request may close these issues.

3 participants