From e0ca6d7a2266aec2e53949128efdfa996c202899 Mon Sep 17 00:00:00 2001 From: Ivan Miskovic Date: Mon, 19 Oct 2020 11:23:06 +1300 Subject: [PATCH] Make ref types' current property non-optional --- hooks/src/index.d.ts | 7 ++----- src/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hooks/src/index.d.ts b/hooks/src/index.d.ts index 63ebcad382..b0497615d8 100644 --- a/hooks/src/index.d.ts +++ b/hooks/src/index.d.ts @@ -40,7 +40,7 @@ export function useReducer( init: (arg: I) => S ): [S, (action: A) => void]; -type PropRef = { current?: T }; +type PropRef = { current: T }; type Ref = { current: T }; /** @@ -123,10 +123,7 @@ export function useContext(context: PreactContext): T; * @param value Custom hook name or object that is passed to formatter * @param formatter Formatter to modify value before sending it to the devtools */ -export function useDebugValue( - value: T, - formatter?: (value: T) => any -): void; +export function useDebugValue(value: T, formatter?: (value: T) => any): void; export function useErrorBoundary( callback?: (error: any) => Promise | void diff --git a/src/index.d.ts b/src/index.d.ts index c54ce10e0c..bfc7feeeda 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -39,7 +39,7 @@ declare namespace preact { type Key = string | number | any; - type RefObject = { current?: T | null }; + type RefObject = { current: T | null }; type RefCallback = (instance: T | null) => void; type Ref = RefObject | RefCallback;