Skip to content

Commit 9f96355

Browse files
committed
Create type for FlatpickrAction
The generated types for the action exported as the package default resulted in an action that would not accept any parameters.
1 parent 8d567ff commit 9f96355

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/lib/actions.svelte.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ function attachFlatpickr(node, opts, plugins = opts.noCalendar ? [] : [yearDropd
289289
return fp;
290290
}
291291

292-
/** @type {import('svelte/action').Action} */
292+
/** @type {import('./types.js').FlatpickrAction} */
293293
export default function (node, options = defaultOptions) {
294294
if (options.isMonthPicker) {
295295
options = {

src/lib/types.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,8 @@ export default interface FlatpickrOptions {
113113
resetMoveDefault?: boolean; // Handling reset and move to calendar to default date.
114114
resetToDefault?: boolean; // Handling reset and selected a default date.
115115
}
116+
117+
export type FlatpickrAction<Node extends HTMLElement> = (
118+
node: Node,
119+
parameter?: FlatpickrOptions
120+
) => void | import('svelte/action').ActionReturn<FlatpickrOptions | undefined, any>;

0 commit comments

Comments
 (0)