Ensure that min/max of TimeScaleOptions can be a string#10137
Ensure that min/max of TimeScaleOptions can be a string#10137etimberg merged 1 commit intochartjs:masterfrom
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 |
LeeLenaleee
left a comment
There was a problem hiding this comment.
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