hannnnxiiii opened a new issue, #21746: URL: https://github.com/apache/echarts/issues/21746
### Version 6.1.0 ### Link to Minimal Reproduction https://codesandbox.io/p/sandbox/echarts-min-null-type-error-forked-v4pt8q ### Steps to Reproduce 1. Create a TypeScript project with `strictNullChecks` enabled (e.g. `"strict": true`) 2. Set `min`/`max` of `xAxis`/`yAxis` to `null` (or `undefined`) directly as a value: ```ts const option: echarts.EChartsOption = { yAxis: { min: null, max: null }, series: [{ type: 'line', data: [[1, 2], [2, 3]] }] }; ``` ### Current Behavior TypeScript compile error: > Type '{ min: null; max: null; }' is not assignable to type 'YAXisOption | YAXisOption[] | undefined'. `null`/`undefined` are missing from the direct value union of the `min`/`max` option type defined in `src/coord/axisCommonTypes.ts`: ```ts min?: ScaleDataValue | 'dataMin' | ((extent: {min: number, max: number}) => ScaleDataValue | NullUndefined); ``` Note that #21313 added `NullUndefined` only to the **function return type**, not to the direct value. Since `ScaleDataValue` (`number | string | Date`) does not include `null`, passing `null` directly still fails the type check. ### Expected Behavior `null`/`undefined` should be accepted as direct values. The JSDoc comment above the option already documents this behavior: > + null/undefined: auto decide min value (consider pretty look and boundaryGap). And it works at runtime — only the type definition is missing it. Related docs: https://echarts.apache.org/en/option.html#yAxis.max ### Environment ```markdown - OS: macOS - Browser: Chrome - Framework: TypeScript + any framework ``` ### Any additional comments? Related fixed issue #21312 / PR #21313 only covered the function form (`max: () => null`), the direct value form (`max: null`) is still not covered. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
