Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recoil

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recoil - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

cjs/__test_utils__/Recoil_TestingUtils.js.flow

17

CHANGELOG.md
# Change Log
## UPCOMING
***Add new changes here as they land***
### Pending
- Memory management

@@ -9,3 +12,17 @@ - useTransition() compatibility

## 0.5.0 (2021-11-03)
- Added `useRecoilRefresher_UNSTABLE()` hook which forces a selector to re-run it's `get()`, and is a no-op for an atom. (#972, #1294, #1302)
- Atom effect improvements:
- Add `getLoadable()`, `getPromise()`, and `getInfo_UNSTABLE()` to Atom Effects interface for reading other atoms. (#1205, #1210)
- Add `isReset` parameter to `onSet()` callback to know if the atom is being reset or not. (#1358, #1345)
- `Loadable` improvements:
- Publish `RecoilLoadable` interface with factories and type checking for Loadables. (#1263, #1264, #1312)
- Ability to map Loadables with other Loadables. (#1180)
- Re-implement Loadable as classes. (#1315)
- Improved dev-mode checks:
- Atoms freeze default, initialized, and async values. Selectors should not freeze upstream dependencies. (#1261, #1259)
- Perform runtime check that required options are provided when creating atoms and selectors. (#1324)
- Allow class instances in family parameters for Flow
## 0.4.1 (2021-08-26)

@@ -12,0 +29,0 @@

451

index.d.ts
// Minimum TypeScript Version: 3.7
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+recoil
*/
/**
* This file is a manual translation of the flow types, which are the source of truth, so we should not introduce new terminology or behavior in this file.
*/
export { };
export { };
import * as React from 'react';
import * as React from 'react';
// state.d.ts
type NodeKey = string;
// state.d.ts
type NodeKey = string;
// node.d.ts
export class DefaultValue {
// node.d.ts
export class DefaultValue {
private __tag: 'DefaultValue';
}
}
// recoilRoot.d.ts
export type RecoilRootProps = {
// recoilRoot.d.ts
export type RecoilRootProps = {
initializeState?: (mutableSnapshot: MutableSnapshot) => void,
override?: true,
} | {override: false};
} | {override: false};
export const RecoilRoot: React.FC<RecoilRootProps>;
/**
* Root component for managing Recoil state. Most Recoil hooks should be
* called from a component nested in a <RecoilRoot>
*/
export const RecoilRoot: React.FC<RecoilRootProps>;
// Snapshot.d.ts
declare const SnapshotID_OPAQUE: unique symbol;
export interface SnapshotID {
// Snapshot.d.ts
declare const SnapshotID_OPAQUE: unique symbol;
export interface SnapshotID {
readonly [SnapshotID_OPAQUE]: true;
}
}
interface ComponentInfo {
interface ComponentInfo {
name: string;
}
}
interface AtomInfo<T> {
interface AtomInfo<T> {
loadable?: Loadable<T>;

@@ -48,5 +61,5 @@ isActive: boolean;

};
}
}
export class Snapshot {
export class Snapshot {
getID(): SnapshotID;

@@ -60,11 +73,11 @@ getLoadable<T>(recoilValue: RecoilValue<T>): Loadable<T>;

retain(): () => void;
}
}
export class MutableSnapshot extends Snapshot {
export class MutableSnapshot extends Snapshot {
set: SetRecoilState;
reset: ResetRecoilState;
}
}
// Effect is called the first time a node is used with a <RecoilRoot>
export type AtomEffect<T> = (param: {
// Effect is called the first time a node is used with a <RecoilRoot>
export type AtomEffect<T> = (param: {
node: RecoilState<T>,

@@ -85,8 +98,8 @@ trigger: 'set' | 'get',

onSet: (
param: (newValue: T, oldValue: T | DefaultValue) => void,
param: (newValue: T, oldValue: T | DefaultValue, isReset: boolean) => void,
) => void,
}) => void | (() => void);
}) => void | (() => void);
// atom.d.ts
export interface AtomOptions<T> {
// atom.d.ts
export interface AtomOptions<T> {
key: NodeKey;

@@ -96,40 +109,40 @@ default: RecoilValue<T> | Promise<T> | T;

dangerouslyAllowMutability?: boolean;
}
}
/**
* Creates an atom, which represents a piece of writeable state
*/
/**
* Creates an atom, which represents a piece of writeable state
*/
export function atom<T>(options: AtomOptions<T>): RecoilState<T>;
// selector.d.ts
export type GetRecoilValue = <T>(recoilVal: RecoilValue<T>) => T;
export type GetCallback = <Args extends ReadonlyArray<unknown>, Return>(
// selector.d.ts
export type GetRecoilValue = <T>(recoilVal: RecoilValue<T>) => T;
export type GetCallback = <Args extends ReadonlyArray<unknown>, Return>(
fn: (interface: Readonly<{snapshot: Snapshot}>) => (...args: Args) => Return,
) => (...args: Args) => Return;
) => (...args: Args) => Return;
export type SetRecoilState = <T>(
export type SetRecoilState = <T>(
recoilVal: RecoilState<T>,
newVal: T | DefaultValue | ((prevValue: T) => T | DefaultValue),
) => void;
) => void;
export type ResetRecoilState = (recoilVal: RecoilState<any>) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
export type ResetRecoilState = (recoilVal: RecoilState<any>) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
// export type EqualityPolicy = 'reference' | 'value'; TODO: removing while we discuss long term API
// export type EqualityPolicy = 'reference' | 'value'; TODO: removing while we discuss long term API
export type EvictionPolicy = 'lru' | 'keep-all' | 'most-recent';
export type EvictionPolicy = 'lru' | 'keep-all' | 'most-recent';
// TODO: removing while we discuss long term API
// export type CachePolicy =
// | {eviction: 'lru', maxSize: number, equality?: EqualityPolicy}
// | {eviction: 'none', equality?: EqualityPolicy}
// | {eviction?: undefined, equality: EqualityPolicy};
// TODO: removing while we discuss long term API
// export type CachePolicy =
// | {eviction: 'lru', maxSize: number, equality?: EqualityPolicy}
// | {eviction: 'none', equality?: EqualityPolicy}
// | {eviction?: undefined, equality: EqualityPolicy};
// TODO: removing while we discuss long term API
// export interface CachePolicyWithoutEviction {
// equality: EqualityPolicy;
// }
// TODO: removing while we discuss long term API
// export interface CachePolicyWithoutEviction {
// equality: EqualityPolicy;
// }
export type CachePolicyWithoutEquality = {eviction: 'lru', maxSize: number} | {eviction: 'keep-all'} | {eviction: 'most-recent'};
export type CachePolicyWithoutEquality = {eviction: 'lru', maxSize: number} | {eviction: 'keep-all'} | {eviction: 'most-recent'};
export interface ReadOnlySelectorOptions<T> {
export interface ReadOnlySelectorOptions<T> {
key: string;

@@ -142,5 +155,5 @@ get: (opts: {

cachePolicy_UNSTABLE?: CachePolicyWithoutEquality; // TODO: using the more restrictive CachePolicyWithoutEquality while we discuss long term API
}
}
export interface ReadWriteSelectorOptions<T> extends ReadOnlySelectorOptions<T> {
export interface ReadWriteSelectorOptions<T> extends ReadOnlySelectorOptions<T> {
set: (

@@ -154,16 +167,19 @@ opts: {

) => void;
}
}
export function selector<T>(options: ReadWriteSelectorOptions<T>): RecoilState<T>;
export function selector<T>(options: ReadOnlySelectorOptions<T>): RecoilValueReadOnly<T>;
/**
* Creates a selector which represents derived state.
*/
export function selector<T>(options: ReadWriteSelectorOptions<T>): RecoilState<T>;
export function selector<T>(options: ReadOnlySelectorOptions<T>): RecoilValueReadOnly<T>;
// hooks.d.ts
export type SetterOrUpdater<T> = (valOrUpdater: ((currVal: T) => T) | T) => void;
export type Resetter = () => void;
export interface TransactionInterface_UNSTABLE {
// hooks.d.ts
export type SetterOrUpdater<T> = (valOrUpdater: ((currVal: T) => T) | T) => void;
export type Resetter = () => void;
export interface TransactionInterface_UNSTABLE {
get<T>(a: RecoilValue<T>): T;
set<T>(s: RecoilState<T>, u: ((currVal: T) => T) | T): void;
reset(s: RecoilState<any>): void;
}
export type CallbackInterface = Readonly<{
}
export type CallbackInterface = Readonly<{
set: <T>(recoilVal: RecoilState<T>, valOrUpdater: ((currVal: T) => T) | T) => void;

@@ -174,64 +190,67 @@ reset: (recoilVal: RecoilState<any>) => void; // eslint-disable-line @typescript-eslint/no-explicit-any

transact_UNSTABLE: (cb: (i: TransactionInterface_UNSTABLE) => void) => void;
}>;
}>;
/**
* Returns the value of an atom or selector (readonly or writeable) and
* subscribes the components to future updates of that state.
*/
export function useRecoilValue<T>(recoilValue: RecoilValue<T>): T;
/**
* Returns the value of an atom or selector (readonly or writeable) and
* subscribes the components to future updates of that state.
*/
export function useRecoilValue<T>(recoilValue: RecoilValue<T>): T;
/**
* Returns a Loadable representing the status of the given Recoil state
* and subscribes the component to future updates of that state. Useful
* for working with async selectors.
*/
export function useRecoilValueLoadable<T>(recoilValue: RecoilValue<T>): Loadable<T>;
/**
* Returns a Loadable representing the status of the given Recoil state
* and subscribes the component to future updates of that state. Useful
* for working with async selectors.
*/
export function useRecoilValueLoadable<T>(recoilValue: RecoilValue<T>): Loadable<T>;
/**
* Returns a tuple where the first element is the value of the recoil state
* and the second is a setter to update that state. Subscribes component
* to updates of the given state.
*/
export function useRecoilState<T>(recoilState: RecoilState<T>): [T, SetterOrUpdater<T>];
/**
* Returns a tuple where the first element is the value of the recoil state
* and the second is a setter to update that state. Subscribes component
* to updates of the given state.
*/
export function useRecoilState<T>(recoilState: RecoilState<T>): [T, SetterOrUpdater<T>];
/**
* Returns a tuple where the first element is a Loadable and the second
* element is a setter function to update the given state. Subscribes
* component to updates of the given state.
*/
export function useRecoilStateLoadable<T>(recoilState: RecoilState<T>): [Loadable<T>, SetterOrUpdater<T>];
/**
* Returns a tuple where the first element is a Loadable and the second
* element is a setter function to update the given state. Subscribes
* component to updates of the given state.
*/
export function useRecoilStateLoadable<T>(recoilState: RecoilState<T>): [Loadable<T>, SetterOrUpdater<T>];
/**
* Returns a setter function for updating Recoil state. Does not subscribe
* the component to the given state.
*/
/**
* Returns a setter function for updating Recoil state. Does not subscribe
* the component to the given state.
*/
export function useSetRecoilState<T>(recoilState: RecoilState<T>): SetterOrUpdater<T>;
export function useSetRecoilState<T>(recoilState: RecoilState<T>): SetterOrUpdater<T>;
/**
* Returns a function that will reset the given state to its default value.
*/
export function useResetRecoilState(recoilState: RecoilState<any>): Resetter; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Returns a function that will reset the given state to its default value.
*/
export function useResetRecoilState(recoilState: RecoilState<any>): Resetter; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Returns current info about an atom
*/
export function useGetRecoilValueInfo_UNSTABLE(): <T>(recoilValue: RecoilValue<T>) => AtomInfo<T>;
/**
* Returns current info about an atom
*/
export function useGetRecoilValueInfo_UNSTABLE(): <T>(recoilValue: RecoilValue<T>) => AtomInfo<T>;
/**
* Returns a function that will run the callback that was passed when
* calling this hook. Useful for accessing Recoil state in response to
* events.
*/
export function useRecoilCallback<Args extends ReadonlyArray<unknown>, Return>(
/**
* Returns a function that will run the callback that was passed when
* calling this hook. Useful for accessing Recoil state in response to
* events.
*/
export function useRecoilCallback<Args extends ReadonlyArray<unknown>, Return>(
fn: (interface: CallbackInterface) => (...args: Args) => Return,
deps?: ReadonlyArray<unknown>,
): (...args: Args) => Return;
): (...args: Args) => Return;
export function useRecoilTransaction_UNSTABLE<Args extends ReadonlyArray<unknown>>(
/**
* Returns a function that executes an atomic transaction for updating Recoil state.
*/
export function useRecoilTransaction_UNSTABLE<Args extends ReadonlyArray<unknown>>(
fn: (interface: TransactionInterface_UNSTABLE) => (...args: Args) => void,
deps?: ReadonlyArray<unknown>,
): (...args: Args) => void;
): (...args: Args) => void;
export function useRecoilTransactionObserver_UNSTABLE(
export function useRecoilTransactionObserver_UNSTABLE(
callback: (opts: {

@@ -241,20 +260,31 @@ snapshot: Snapshot,

}) => void,
): void;
): void;
export function useGotoRecoilSnapshot(): (snapshot: Snapshot) => void;
/**
* Updates Recoil state to match the provided snapshot.
*/
export function useGotoRecoilSnapshot(): (snapshot: Snapshot) => void;
export function useRecoilSnapshot(): Snapshot;
/**
* Returns a snapshot of the current Recoil state and subscribes the component
* to re-render when any state is updated.
*/
export function useRecoilSnapshot(): Snapshot;
// useRecoilBridgeAcrossReactRoots.d.ts
export const RecoilBridge: React.FC;
export function useRecoilBridgeAcrossReactRoots_UNSTABLE(): typeof RecoilBridge;
// useRecoilRefresher.d.ts
/**
* Clears the cache for a selector causing it to be reevaluated.
*/
export function useRecoilRefresher_UNSTABLE(): (recoilValue: RecoilValue<any>) => void;
// loadable.d.ts
declare const LoadablePromiseValue_OPAQUE: unique symbol;
interface LoadablePromiseValue {
readonly [LoadablePromiseValue_OPAQUE]: true;
}
type LoadablePromise<T> = Promise<LoadablePromiseValue>;
// useRecoilBridgeAcrossReactRoots.d.ts
export const RecoilBridge: React.FC;
/**
* Returns a component that acts like a <RecoilRoot> but shares the same store
* as the current <RecoilRoot>.
*/
export function useRecoilBridgeAcrossReactRoots_UNSTABLE(): typeof RecoilBridge;
interface BaseLoadable<T> {
// loadable.d.ts
interface BaseLoadable<T> {
getValue: () => T;

@@ -266,6 +296,6 @@ toPromise: () => Promise<T>;

is: (other: Loadable<any>) => boolean;
map: <S>(map: (from: T) => Promise<S> | S) => Loadable<S>;
}
map: <S>(map: (from: T) => Loadable<S> | Promise<S> | S) => Loadable<S>;
}
interface ValueLoadable<T> extends BaseLoadable<T> {
interface ValueLoadable<T> extends BaseLoadable<T> {
state: 'hasValue';

@@ -276,13 +306,13 @@ contents: T;

promiseMaybe: () => undefined;
}
}
interface LoadingLoadable<T> extends BaseLoadable<T> {
interface LoadingLoadable<T> extends BaseLoadable<T> {
state: 'loading';
contents: LoadablePromise<T>;
contents: Promise<T>;
valueMaybe: () => undefined;
errorMaybe: () => undefined;
promiseMaybe: () => Promise<T>;
}
}
interface ErrorLoadable<T> extends BaseLoadable<T> {
interface ErrorLoadable<T> extends BaseLoadable<T> {
state: 'hasError';

@@ -293,5 +323,5 @@ contents: any;

promiseMaybe: () => undefined;
}
}
export type Loadable<T> =
export type Loadable<T> =
| ValueLoadable<T>

@@ -301,4 +331,4 @@ | LoadingLoadable<T>

// recoilValue.d.ts
declare class AbstractRecoilValue<T> {
// recoilValue.d.ts
declare class AbstractRecoilValue<T> {
__tag: [T];

@@ -309,5 +339,5 @@ __cTag: (t: T) => void; // for contravariance

constructor(newKey: NodeKey);
}
}
declare class AbstractRecoilValueReadonly<T> {
declare class AbstractRecoilValueReadonly<T> {
__tag: [T];

@@ -317,16 +347,19 @@

constructor(newKey: NodeKey);
}
}
export class RecoilState<T> extends AbstractRecoilValue<T> {}
export class RecoilValueReadOnly<T> extends AbstractRecoilValueReadonly<T> {}
export type RecoilValue<T> = RecoilValueReadOnly<T> | RecoilState<T>;
export class RecoilState<T> extends AbstractRecoilValue<T> {}
export class RecoilValueReadOnly<T> extends AbstractRecoilValueReadonly<T> {}
export type RecoilValue<T> = RecoilValueReadOnly<T> | RecoilState<T>;
export function isRecoilValue(val: unknown): val is RecoilValue<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Returns true if the parameter is a Recoil atom or selector.
*/
export function isRecoilValue(val: unknown): val is RecoilValue<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
/** Utilities */
/** Utilities */
// bigint not supported yet
type Primitive = undefined | null | boolean | number | symbol | string;
// bigint not supported yet
type Primitive = undefined | null | boolean | number | symbol | string;
export type SerializableParam =
export type SerializableParam =
| Primitive

@@ -337,3 +370,3 @@ | {toJSON: () => string}

export interface AtomFamilyOptions<T, P extends SerializableParam> {
export interface AtomFamilyOptions<T, P extends SerializableParam> {
key: NodeKey;

@@ -344,9 +377,12 @@ dangerouslyAllowMutability?: boolean;

// cachePolicyForParams_UNSTABLE?: CachePolicyWithoutEviction; TODO: removing while we discuss long term API
}
}
export function atomFamily<T, P extends SerializableParam>(
/**
* Returns a function which returns a memoized atom for each unique parameter value.
*/
export function atomFamily<T, P extends SerializableParam>(
options: AtomFamilyOptions<T, P>,
): (param: P) => RecoilState<T>;
): (param: P) => RecoilState<T>;
export interface ReadOnlySelectorFamilyOptions<T, P extends SerializableParam> {
export interface ReadOnlySelectorFamilyOptions<T, P extends SerializableParam> {
key: string;

@@ -360,5 +396,5 @@ get: (param: P) => (opts: {

dangerouslyAllowMutability?: boolean;
}
}
export interface ReadWriteSelectorFamilyOptions<T, P extends SerializableParam> {
export interface ReadWriteSelectorFamilyOptions<T, P extends SerializableParam> {
key: string;

@@ -378,65 +414,118 @@ get: (param: P) => (opts: {

dangerouslyAllowMutability?: boolean;
}
}
/**
* Returns a function which returns a memoized atom for each unique parameter value.
*/
export function selectorFamily<T, P extends SerializableParam>(
options: ReadWriteSelectorFamilyOptions<T, P>,
options: ReadWriteSelectorFamilyOptions<T, P>,
): (param: P) => RecoilState<T>;
/**
* Returns a function which returns a memoized atom for each unique parameter value.
*/
export function selectorFamily<T, P extends SerializableParam>(
options: ReadOnlySelectorFamilyOptions<T, P>,
options: ReadOnlySelectorFamilyOptions<T, P>,
): (param: P) => RecoilValueReadOnly<T>;
/**
* Returns a selector that always has a constant value.
*/
export function constSelector<T extends SerializableParam>(constant: T): RecoilValueReadOnly<T>;
/**
* Returns a selector which is always in the provided error state.
*/
export function errorSelector(message: string): RecoilValueReadOnly<never>;
/**
* Casts a selector to be a read-only selector
*/
export function readOnlySelector<T>(atom: RecoilValue<T>): RecoilValueReadOnly<T>;
/**
* Returns a selector that has the value of the provided atom or selector as a Loadable.
* This means you can use noWait() to avoid entering an error or suspense state in
* order to manually handle those cases.
*/
export function noWait<T>(state: RecoilValue<T>): RecoilValueReadOnly<Loadable<T>>;
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-explicit-any */
export type UnwrapRecoilValue<T> = T extends RecoilValue<infer R> ? R : never;
export type UnwrapRecoilValue<T> = T extends RecoilValue<infer R> ? R : never;
export type UnwrapRecoilValues<T extends Array<RecoilValue<any>> | { [key: string]: RecoilValue<any> }> = {
export type UnwrapRecoilValues<T extends Array<RecoilValue<any>> | { [key: string]: RecoilValue<any> }> = {
[P in keyof T]: UnwrapRecoilValue<T[P]>;
};
export type UnwrapRecoilValueLoadables<T extends Array<RecoilValue<any>> | { [key: string]: RecoilValue<any> }> = {
};
export type UnwrapRecoilValueLoadables<T extends Array<RecoilValue<any>> | { [key: string]: RecoilValue<any> }> = {
[P in keyof T]: Loadable<UnwrapRecoilValue<T[P]>>;
};
};
export function waitForNone<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
export function waitForNone<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
export function waitForNone<RecoilValues extends { [key: string]: RecoilValue<any> }>(
export function waitForNone<RecoilValues extends { [key: string]: RecoilValue<any> }>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
export function waitForAny<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
export function waitForAny<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
export function waitForAny<RecoilValues extends { [key: string]: RecoilValue<any> }>(
export function waitForAny<RecoilValues extends { [key: string]: RecoilValue<any> }>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
export function waitForAll<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
export function waitForAll<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValues<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValues<RecoilValues>>;
export function waitForAll<RecoilValues extends { [key: string]: RecoilValue<any> }>(
export function waitForAll<RecoilValues extends { [key: string]: RecoilValue<any> }>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValues<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValues<RecoilValues>>;
export function waitForAllSettled<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
export function waitForAllSettled<RecoilValues extends Array<RecoilValue<any>> | [RecoilValue<any>]>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
export function waitForAllSettled<RecoilValues extends { [key: string]: RecoilValue<any> }>(
export function waitForAllSettled<RecoilValues extends { [key: string]: RecoilValue<any> }>(
param: RecoilValues,
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
): RecoilValueReadOnly<UnwrapRecoilValueLoadables<RecoilValues>>;
/* eslint-enable @typescript-eslint/no-explicit-any */
export type UnwrapLoadable<T> = T extends Loadable<infer R> ? R : never;
export type UnwrapLoadables<T extends Array<Loadable<any>> | { [key: string]: Loadable<any> }> = {
[P in keyof T]: UnwrapLoadable<T[P]>;
};
export function snapshot_UNSTABLE(initializeState?: (shapshot: MutableSnapshot) => void): Snapshot;
/* eslint-disable @typescript-eslint/no-unused-vars */
export namespace RecoilLoadable {
/**
* Factory to make a Loadable object. If a Promise is provided the Loadable will
* be in a 'loading' state until the Promise is either resolved or rejected.
*/
function of<T>(x: T | Promise<T>): Loadable<T>;
/**
* Factory to make a Loadable object in an error state.
*/
function error(x: any): ErrorLoadable<any>;
/**
* Factory to make a Loadable which is resolved when all of the Loadables provided
* to it are resolved or any one has an error. The value is an array of the values
* of all of the provided Loadables. This is comparable to Promise.all() for Loadables.
*/
function all<Inputs extends Array<Loadable<any>> | [Loadable<any>]>(inputs: Inputs): Loadable<UnwrapLoadables<Inputs>>;
function all<Inputs extends {[key: string]: Loadable<any>}>(inputs: Inputs): Loadable<UnwrapLoadables<Inputs>>;
/**
* Returns true if the provided parameter is a Loadable type.
*/
function isLoadable(x: any): x is Loadable<any>;
}
/* eslint-enable @typescript-eslint/no-unused-vars */
/* eslint-enable @typescript-eslint/no-explicit-any */
/**
* Factory to produce a Recoil snapshot object with all atoms in the default state.
*/
export function snapshot_UNSTABLE(initializeState?: (shapshot: MutableSnapshot) => void): Snapshot;
{
"name": "recoil",
"version": "0.4.1",
"version": "0.5.0",
"description": "Recoil - A state management library for React",

@@ -21,3 +21,3 @@ "main": "cjs/recoil.js",

"build": "rollup -c && node scripts/postbuild.js",
"test": "jest src/*",
"test": "jest packages/*",
"format": "prettier --write \"./**/*.{js,md,json}\"",

@@ -53,2 +53,3 @@ "flow": "flow --show-all-errors",

"@babel/preset-react": "^7.9.4",
"@rollup/plugin-alias": "^3.1.5",
"@rollup/plugin-babel": "^5.0.0",

@@ -65,3 +66,3 @@ "@rollup/plugin-commonjs": "^11.1.0",

"eslint": "^7.2.0",
"eslint-plugin-fb-www": "^1.0.4",
"eslint-plugin-fb-www": "^1.0.7",
"eslint-plugin-flowtype": "^5.1.3",

@@ -72,3 +73,3 @@ "eslint-plugin-jest": "^23.13.2",

"eslint-plugin-rulesdir": "^0.1.0",
"flow-bin": "^0.129.0",
"flow-bin": "^0.162.1",
"gen-flow-files": "^0.4.11",

@@ -80,3 +81,3 @@ "husky": ">=4",

"lint-staged": ">=10",
"prettier": "^2.0.5",
"prettier": "^2.1.4",
"promise-polyfill": "^8.1.3",

@@ -83,0 +84,0 @@ "react": ">=16.13.1",

@@ -1,2 +0,2 @@

# Recoil &middot; [![NPM Version](https://img.shields.io/npm/v/recoil)](https://www.npmjs.com/package/recoil) [![Node.js CI](https://github.com/facebookexperimental/Recoil/workflows/Node.js%20CI/badge.svg)](https://github.com/facebookexperimental/Recoil/actions) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebookexperimental/Recoil/blob/master/LICENSE) [![Follow on Twitter](https://img.shields.io/twitter/follow/recoiljs?label=Follow%20Recoil&style=social)](https://twitter.com/recoiljs)
# Recoil &middot; [![NPM Version](https://img.shields.io/npm/v/recoil)](https://www.npmjs.com/package/recoil) [![Node.js CI](https://github.com/facebookexperimental/Recoil/workflows/Node.js%20CI/badge.svg)](https://github.com/facebookexperimental/Recoil/actions) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebookexperimental/Recoil/blob/main/LICENSE) [![Follow on Twitter](https://img.shields.io/twitter/follow/recoiljs?label=Follow%20Recoil&style=social)](https://twitter.com/recoiljs)

@@ -3,0 +3,0 @@ Recoil is an experimental set of utilities for state management with React.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc