Incorrect TS type for `markerList` of QSliderSlots
thexeos opened this issue · comments
The type definition for when defining custom QSlider marker labels, defined here:
quasar/ui/src/components/slider/use-slider.json
Lines 315 to 316 in 881803b
quasar/ui/src/components/slider/use-slider.json
Lines 408 to 409 in 881803b
Results in an incorrect generated types.
Show generated TS interface
export interface QSliderSlots {
/**
* What should the menu display after filtering options and none are left to be displayed; Suggestion: <div>
* @param scope
*/
"marker-label": (scope: {
/**
* Config for current marker label
*/
marker: SliderMarkerLabelConfig;
/**
* Array of marker label configs
*/
markerList: SliderMarkerLabelArrayConfig[];
/**
* Object with key-value where key is the model and the value is the marker label config
*/
markerMap: SliderMarkerLabelObjectConfig;
/**
* Required CSS classes to be applied to the marker element
*/
classes: string;
/**
* Get CSS style Object to apply to a marker element at respective model value; For perf reasons, use only if requested model value is not already part of markerMap
* @param value The marker label equivalent model value
* @returns CSS style Object to apply to a marker element at respective model value
*/
getStyle: (value: number) => any;
}) => VNode[];
/**
* What should the menu display after filtering options and none are left to be displayed; Suggestion: <div>
* @param scope
*/
"marker-label-group": (scope: {
/**
* Array of marker label configs
*/
markerList: SliderMarkerLabelArrayConfig[];
/**
* Object with key-value where key is the model and the value is the marker label config
*/
markerMap: SliderMarkerLabelObjectConfig;
/**
* Required CSS classes to be applied to the marker element
*/
classes: string;
/**
* Get CSS style Object to apply to a marker element at respective model value; For perf reasons, use only if requested model value is not already part of markerMap
* @param value The marker label equivalent model value
* @returns CSS style Object to apply to a marker element at respective model value
*/
getStyle: (value: number) => any;
}) => VNode[];
}
Note how markerList
in generated types for both slots is SliderMarkerLabelArrayConfig[]
. However, SliderMarkerLabelArrayConfig
is already an array of SliderMarkerLabelConfig
:
quasar/ui/types/api/slider.d.ts
Line 43 in 881803b
So we end up with typeof markerList === SliderMarkerLabelConfig[][]
.
Thank you.
There is another problem.
Using the example with the correct type leads to Vue: Type Partial<CSSStyleDeclaration> is not assignable to type StyleValue
at :style="markerList[val].style"
.