From 0fc703673fd77fdd763071101a0ab4e0abb7b144 Mon Sep 17 00:00:00 2001 From: Seyyed Morteza Moosavi Date: Wed, 6 Nov 2019 19:50:08 +0330 Subject: [PATCH] fix(use-wire): support initializer function returning undefined --- docs/api/react-wire.usewire.md | 4 ++-- src/use-wire.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/react-wire.usewire.md b/docs/api/react-wire.usewire.md index 7770b02..3b4524e 100644 --- a/docs/api/react-wire.usewire.md +++ b/docs/api/react-wire.usewire.md @@ -11,7 +11,7 @@ creates and returns a new wire. ```typescript export declare function useWire( upLink: Wire | null | undefined, - initialValue?: Value | (() => Value), + initialValue?: Value | (() => Value | undefined), ): Wire; ``` @@ -20,7 +20,7 @@ export declare function useWire( | Parameter | Type | Description | | ------------ | ----------------------------------------------------------- | ------------------------------------------------------- | | upLink | Wire<Value> | null | undefined | the up-link wire to be connected to and sync value with | -| initialValue | Value | (() => Value) | initial value or initializer function | +| initialValue | Value | (() => Value | undefined) | initial value or initializer function | Returns: diff --git a/src/use-wire.ts b/src/use-wire.ts index f438d9b..aa49664 100644 --- a/src/use-wire.ts +++ b/src/use-wire.ts @@ -27,7 +27,7 @@ import { _WireImpl } from './wire.impl'; */ export function useWire( upLink: Wire | null | undefined, - initialValue?: Value | (() => Value), + initialValue?: Value | (() => Value | undefined), ): Wire { const [wire] = useState( () =>