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

Stricter return value check on LGraphCanvas.getExtraMenuOptions #401

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

huchenlei
Copy link
Member

@huchenlei huchenlei commented Dec 27, 2024

In javascript !![] evals to true, so the old check would always pass if the callback obeys the type signature, which can cause an extra null item being added (separator). This PR fixes the issue which makes empty array return value generate a separator.

getExtraMenuOptions?(
  this: LGraphNode,
  canvas: LGraphCanvas,
  options: IContextMenuValue[],
): IContextMenuValue[]

@webfiltered
Copy link
Collaborator

Comment for history only: return type was implemented without consideration for explicit | undefined req. for optional return - missed due to strict mode disabled.

@huchenlei huchenlei merged commit 54d7292 into master Dec 27, 2024
4 checks passed
@huchenlei huchenlei deleted the strict_extra branch December 27, 2024 18:51
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.

2 participants