-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Ensure that min/max of TimeScaleOptions can be a string #10137
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
Conversation
@kurkle @LeeLenaleee not sure if you have a better solution. It seems like TS doesn't override the The proposed solution here breaks new axis types and we have a test covering that |
Is this because Lines 3178 to 3180 in aebbb5a
According to my understanding (as a TS novice with C++ background), if (That is, properties that exist on both types are intersected. This might seem different from the behavior when the input types have distinct properties and the output type gains both properties - e.g. in the TypeScript example, I am not sure what this implies for a fix. If any |
Instead of removing the min and max definition from the cartesianScaleOpts you could omit the min and max property when you assign the cartesianScaleOpts to the timeScaleOpts: export type TimeScaleOptions = Omit<CartesianScaleOptions, 'min' | 'max'> & {
// All timescale opts
} Although seems like this has to be done for the categoryScaleOpts too then |
@StephanTLavavej that's a really helpful summary 😄. We are definitely going for I did also test the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the base for min/max is now number | string
it would be cleaner if we removed them from the CategoryScaleOptions
and TimeScaleOptions
Just tested this and not sure if this is the best way to fix it. So maby the Omit route is better since then it will also throw an error if you dont explicitly specify that the y scale is of type linear |
This sounds like a really good reason at v4 to require I will push up the |
c953a66
to
8003653
Compare
8003653
to
38144c3
Compare
Resolves #10134