Skip to content

Commit 21e53fc

Browse files
committed
Fix types for scriptable init
It takes its parameters as a context object, not three separate parameters. configuration.md and migrationV3.md explain that it returns an AnnotationBoxModel, not an AnnotationElement.
1 parent 1e95744 commit 21e53fc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

types/options.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,17 @@ export interface LabelAnnotationOptions extends CoreAnnotationOptions, LabelType
138138
rotation?: Scriptable<number, PartialEventContext>
139139
}
140140

141+
interface InitContext {
142+
chart: Chart,
143+
properties: AnnotationBoxModel,
144+
options: AnnotationOptions
145+
}
146+
141147
export interface DoughnutLabelAnnotationOptions extends AnnotationEvents, DoughnutLabelOptions, ShadowOptions {
142148
autoFit?: Scriptable<boolean, PartialEventContext>,
143149
autoHide?: Scriptable<boolean, PartialEventContext>,
144150
id?: string,
145-
init: boolean | ((chart: Chart, properties: AnnotationBoxModel, options: AnnotationOptions) => void | boolean | AnnotationBoxModel),
151+
init: boolean | ((ctx: InitContext) => void | boolean | AnnotationElement),
146152
spacing?: Scriptable<number, PartialEventContext>
147153
}
148154

0 commit comments

Comments
 (0)