rxjs-hooks
Advanced tools
Comparing version 0.4.2 to 0.4.3
import { Observable, BehaviorSubject } from 'rxjs'; | ||
import { RestrictArray, Not } from './type'; | ||
declare type VoidableCallback<EventValue> = [EventValue] extends [void] ? () => void : (val: EventValue) => void; | ||
declare type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N; | ||
declare type IsAny<T> = IfAny<T, true, false>; | ||
declare type IsVoid<T> = IsAny<T> extends true ? false : [T] extends [void] ? true : false; | ||
declare type VoidableCallback<EventValue> = IsVoid<EventValue> extends true ? () => void : (val: EventValue) => void; | ||
export declare type EventCallbackState<EventValue, State, Inputs = void> = [VoidableCallback<EventValue>, [State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]]; | ||
@@ -5,0 +8,0 @@ export declare type ReturnedState<EventValue, State, Inputs> = [EventCallbackState<EventValue, State, Inputs>[0], EventCallbackState<EventValue, State, Inputs>[1][0]]; |
import { Observable, BehaviorSubject } from 'rxjs'; | ||
import { RestrictArray, Not } from './type'; | ||
declare type VoidableCallback<EventValue> = [EventValue] extends [void] ? () => void : (val: EventValue) => void; | ||
declare type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N; | ||
declare type IsAny<T> = IfAny<T, true, false>; | ||
declare type IsVoid<T> = IsAny<T> extends true ? false : [T] extends [void] ? true : false; | ||
declare type VoidableCallback<EventValue> = IsVoid<EventValue> extends true ? () => void : (val: EventValue) => void; | ||
export declare type EventCallbackState<EventValue, State, Inputs = void> = [VoidableCallback<EventValue>, [State extends void ? null : State, BehaviorSubject<State | null>, BehaviorSubject<RestrictArray<Inputs> | null>]]; | ||
@@ -5,0 +8,0 @@ export declare type ReturnedState<EventValue, State, Inputs> = [EventCallbackState<EventValue, State, Inputs>[0], EventCallbackState<EventValue, State, Inputs>[1][0]]; |
{ | ||
"name": "rxjs-hooks", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "React hooks for RxJS", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
@@ -6,4 +6,11 @@ import { useEffect, useState } from 'react' | ||
type VoidableCallback<EventValue> = [EventValue] extends [void] ? () => void : (val: EventValue) => void | ||
// https://stackoverflow.com/questions/55541275/typescript-check-for-the-any-type | ||
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N | ||
type IsAny<T> = IfAny<T, true, false> | ||
type IsVoid<T> = IsAny<T> extends true ? false : [T] extends [void] ? true : false | ||
type VoidableCallback<EventValue> = IsVoid<EventValue> extends true ? () => void : (val: EventValue) => void | ||
export type EventCallbackState<EventValue, State, Inputs = void> = [ | ||
@@ -10,0 +17,0 @@ VoidableCallback<EventValue>, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
415348
1511