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

refactor(types): decrease specificity of lifecycle hook return type #1167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

J-Michalek
Copy link

@J-Michalek J-Michalek commented May 27, 2024

I find it oddly specific and since I am using https://typescript-eslint.io/rules/explicit-function-return-type/ in my projects I have to explicitely say false | void instead of a simple boolean with it every time there is a tooltip that should have a onShow hook condition. Passing true should work the same as void as the implementation only checks for false.

const showTooltip = false

// There has to be a condition to satisfy the void return type
function onShow(): false | void {
  if (!showTooltip) {
    return false
  }
}

// Ideally this would work
function onShow(): boolean {
  return showTooltip
}

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.

1 participant