From 1a2119715d1a5022f8efef7830e734600a852d8b Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 11 Apr 2022 14:21:04 +0200 Subject: [PATCH] add case for optional parameter --- src/runtime/action/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/action/index.ts b/src/runtime/action/index.ts index 3469ecbb71..b1c344b6e5 100644 --- a/src/runtime/action/index.ts +++ b/src/runtime/action/index.ts @@ -32,7 +32,7 @@ export type ActionReturn = void extends Parameter * The following example defines an action that only works on `
` elements * and optionally accepts a parameter which it has a default value for: * ```ts - * export const myAction: Action = (node, param = { someProperty: true }) => { + * export const myAction: Action = (node, param = { someProperty: true }) => { * // ... * } * ``` @@ -44,4 +44,6 @@ export type ActionReturn = void extends Parameter export type Action = void extends Parameter ? (node: Node) => void | ActionReturn + : undefined extends Parameter + ? (node: Node, parameter?: Parameter) => void | ActionReturn : (node: Node, parameter: Parameter) => void | ActionReturn;