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

[EuiProgress] Allow max property to be undefined #3137

Closed
i-a-n opened this issue Mar 20, 2020 · 2 comments · Fixed by #3198
Closed

[EuiProgress] Allow max property to be undefined #3137

i-a-n opened this issue Mar 20, 2020 · 2 comments · Fixed by #3198
Assignees

Comments

@i-a-n
Copy link
Contributor

i-a-n commented Mar 20, 2020

Spent some time chatting in Slack about this, and was advised to make an issue. Here's the summary of the problem:

The max property alleges that it accepts either a number, or undefined, which checks out when I do either of these:

<EuiProgress max={100} />
<EuiProgress max={undefined} />

.. but TypeScript fails to compile when I do this:

<EuiProgress max={someCondition ? 100 : undefined} />

This doesn't seem to be a TypeScript bug or anything, since this pared-down example still works.

I was able to solve this temporarily by just doing this:

{someCondition ? (
  <EuiProgress max={100} />
) : (
   <EuiProgress />
)}

But I'd like to request that max really would accept undefined so that max={someCondition ? 100 : undefined} would work. Thanks!

@thompsongl
Copy link
Contributor

Stems from the way that max is defined in the context of ExclusiveUnion.

#2984 would alleviate the problem, also, but I'm unsure how far off that work is.

@myasonik
Copy link
Contributor

I don't think anyone is working on it and this seems like a much smaller thing to tackle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants