Skip to content

Commit a75a725

Browse files
committed
minor refactoring
1 parent 51ba7e4 commit a75a725

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

chartlets.js/src/lib/hooks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export function useSignalListeners(
4848
id: string | undefined,
4949
onChange: ComponentChangeHandler,
5050
): { [key: string]: SignalHandler } {
51+
/*
52+
This is a partial representation of the parameter type from
53+
SelectionParameter type from the `vega-lite` module. Since we are
54+
only interested in extracting the handlers, the following
55+
properties are required.
56+
*/
57+
type SelectionParameter = { name: string; select: { on: string } };
5158
/*
5259
Here, we create map of signals which will be then used to create the
5360
map of signal-listeners because not all params are event-listeners, and we
@@ -60,7 +67,7 @@ export function useSignalListeners(
6067
if (!chart.params) return {};
6168
return chart.params
6269
.filter(
63-
(param): param is { name: string; select: { on: string } } =>
70+
(param): param is SelectionParameter =>
6471
isObject(param) &&
6572
param !== null &&
6673
"name" in param &&

0 commit comments

Comments
 (0)