From 4ac52e7194ed64fd6f0ff9eeed2e47cde1d5967b Mon Sep 17 00:00:00 2001 From: Kunall Banerjee Date: Fri, 2 Nov 2018 11:12:14 -0400 Subject: [PATCH] Add declaration files --- .../src/index.d.ts | 18 ++++++++++++++++++ .../react-notification-hook/src/index.d.ts | 12 ++++++++++++ .../react-online-status-hook/src/index.d.ts | 13 +++++++++++++ .../react-page-visible-hook/src/index.d.ts | 16 ++++++++++++++++ packages/react-vibration-hook/src/index.d.ts | 9 +++++++++ 5 files changed, 68 insertions(+) create mode 100644 packages/react-device-orientation-hook/src/index.d.ts create mode 100644 packages/react-notification-hook/src/index.d.ts create mode 100644 packages/react-online-status-hook/src/index.d.ts create mode 100644 packages/react-page-visible-hook/src/index.d.ts create mode 100644 packages/react-vibration-hook/src/index.d.ts diff --git a/packages/react-device-orientation-hook/src/index.d.ts b/packages/react-device-orientation-hook/src/index.d.ts new file mode 100644 index 0000000..54bdc68 --- /dev/null +++ b/packages/react-device-orientation-hook/src/index.d.ts @@ -0,0 +1,18 @@ +export declare type UseState = ( + initialState: T, +) => [T, (newState: T) => void]; +export declare const useState: UseState; +export declare type UseEffect = ( + didUpdate: () => (() => void) | void, + params?: any[], +) => void; +export declare const useEffect: UseEffect; +export interface IOrientationState { + angle: number; + type: string; +} +export declare const defaultState: IOrientationState; +declare const useOrientation: ( + initialState?: IOrientationState, +) => IOrientationState; +export default useOrientation; diff --git a/packages/react-notification-hook/src/index.d.ts b/packages/react-notification-hook/src/index.d.ts new file mode 100644 index 0000000..5c5fa63 --- /dev/null +++ b/packages/react-notification-hook/src/index.d.ts @@ -0,0 +1,12 @@ +export declare type UseCallback = any)>( + callback: T, + args: any[], +) => T; +export declare const useCallback: UseCallback; +export interface INotification { + options?: object; + title: string; +} +export declare const defaultValue: INotification; +declare const useNotification: (value?: INotification) => () => () => void; +export default useNotification; diff --git a/packages/react-online-status-hook/src/index.d.ts b/packages/react-online-status-hook/src/index.d.ts new file mode 100644 index 0000000..4da1e62 --- /dev/null +++ b/packages/react-online-status-hook/src/index.d.ts @@ -0,0 +1,13 @@ +export declare type UseState = ( + initialState: T, +) => [T, (newState: T) => void]; +export declare const useState: UseState; +export declare type UseEffect = ( + didUpdate: () => (() => void) | void, + params?: any[], +) => void; +export declare const useEffect: UseEffect; +export declare const useOfflineOnlineStatus: () => boolean; +export declare const useOfflineStatus: () => boolean; +export declare const useOnlineStatus: () => boolean; +export default useOfflineOnlineStatus; diff --git a/packages/react-page-visible-hook/src/index.d.ts b/packages/react-page-visible-hook/src/index.d.ts new file mode 100644 index 0000000..a6ebc08 --- /dev/null +++ b/packages/react-page-visible-hook/src/index.d.ts @@ -0,0 +1,16 @@ +export declare type UseState = ( + initialState: T, +) => [T, (newState: T) => void]; +export declare const useState: UseState; +export declare type UseEffect = ( + didUpdate: () => (() => void) | void, + params?: any[], +) => void; +export declare const useEffect: UseEffect; +export interface IPageVisibilityState { + readonly hidden: boolean; + readonly visibilityState: string; +} +export declare const initialState: IPageVisibilityState; +declare const useVisible: () => IPageVisibilityState; +export default useVisible; diff --git a/packages/react-vibration-hook/src/index.d.ts b/packages/react-vibration-hook/src/index.d.ts new file mode 100644 index 0000000..5871b36 --- /dev/null +++ b/packages/react-vibration-hook/src/index.d.ts @@ -0,0 +1,9 @@ +export declare type UseCallback = any)>( + callback: T, + args: any[], +) => T; +export declare const useCallback: UseCallback; +export declare type Vibrate = number | number[]; +export declare const defaultValue: Vibrate; +declare const useVibration: (value?: Vibrate) => () => () => void; +export default useVibration;