recoil-next 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -16,7 +16,7 @@ declare abstract class BaseLoadable<T> {
16
16
  is(other: Loadable<any>): boolean;
17
17
  }
18
18
  declare class ValueLoadable<T> extends BaseLoadable<T> {
19
- state: 'hasValue';
19
+ state: "hasValue";
20
20
  contents: T;
21
21
  constructor(value: T);
22
22
  getValue(): T;
@@ -28,7 +28,7 @@ declare class ValueLoadable<T> extends BaseLoadable<T> {
28
28
  map<S>(map: (value: T) => Promise<S> | Loadable<S> | S): Loadable<S>;
29
29
  }
30
30
  declare class ErrorLoadable<T> extends BaseLoadable<T> {
31
- state: 'hasError';
31
+ state: "hasError";
32
32
  contents: unknown;
33
33
  constructor(error: unknown);
34
34
  getValue(): T;
@@ -40,7 +40,7 @@ declare class ErrorLoadable<T> extends BaseLoadable<T> {
40
40
  map<S>(_map: (value: T) => Promise<S> | Loadable<S> | S): Loadable<S>;
41
41
  }
42
42
  declare class LoadingLoadable<T> extends BaseLoadable<T> {
43
- state: 'loading';
43
+ state: "loading";
44
44
  contents: Promise<T>;
45
45
  constructor(promise: Promise<T>);
46
46
  getValue(): T;
@@ -486,7 +486,7 @@ declare function useRecoilTransactionObserver(callback: (info: {
486
486
  declare function useRecoilSnapshot(): Snapshot;
487
487
  declare function useGotoRecoilSnapshot(): (snapshot: Snapshot) => void;
488
488
 
489
- declare function useGetRecoilValueInfo(): (<T>(recoilValue: RecoilValue<T>) => RecoilValueInfo<T>);
489
+ declare function useGetRecoilValueInfo(): <T>(recoilValue: RecoilValue<T>) => RecoilValueInfo<T>;
490
490
 
491
491
  declare function useRecoilRefresher<T>(recoilValue: RecoilValue<T>): () => void;
492
492
 
@@ -500,12 +500,7 @@ type Retainable = RecoilValue<unknown> | RetentionZone;
500
500
  declare function useRetain(retainable: Retainable): void;
501
501
 
502
502
  /**
503
- * Copyright (c) Meta Platforms, Inc. and affiliates.
504
- *
505
- * This source code is licensed under the MIT license found in the
506
- * LICENSE file in the root directory of this source tree.
507
- *
508
- * @oncall recoil
503
+ * TypeScript port of Recoil_atomFamily.js
509
504
  */
510
505
 
511
506
  type AtomFamilyOptionsWithoutDefault<T, P extends Parameter> = Readonly<AtomOptionsWithoutDefault<T> & {
@@ -513,9 +508,9 @@ type AtomFamilyOptionsWithoutDefault<T, P extends Parameter> = Readonly<AtomOpti
513
508
  retainedBy_UNSTABLE?: RetainedBy | ((param: P) => RetainedBy);
514
509
  cachePolicyForParams_UNSTABLE?: CachePolicyWithoutEviction;
515
510
  }>;
516
- type AtomFamilyOptions<T, P extends Parameter> = (Readonly<AtomFamilyOptionsWithoutDefault<T, P> & {
511
+ type AtomFamilyOptions<T, P extends Parameter> = Readonly<AtomFamilyOptionsWithoutDefault<T, P> & {
517
512
  default: RecoilValue<T> | Promise<T> | Loadable<T> | WrappedValue<T> | T | ((param: P) => T | RecoilValue<T> | Promise<T> | Loadable<T> | WrappedValue<T>);
518
- }>) | AtomFamilyOptionsWithoutDefault<T, P>;
513
+ }> | AtomFamilyOptionsWithoutDefault<T, P>;
519
514
  declare function atomFamily<T, P extends Parameter>(options: AtomFamilyOptions<T, P>): (params: P) => RecoilState<T>;
520
515
 
521
516
  /**
@@ -525,25 +520,13 @@ declare function atomFamily<T, P extends Parameter>(options: AtomFamilyOptions<T
525
520
  declare function constSelector<T extends Parameter>(constant: T): RecoilValueReadOnly<T>;
526
521
 
527
522
  /**
528
- * Copyright (c) Meta Platforms, Inc. and affiliates.
529
- *
530
- * This source code is licensed under the MIT license found in the
531
- * LICENSE file in the root directory of this source tree.
532
- *
533
- * @oncall recoil
523
+ * TypeScript port of Recoil_errorSelector.js
534
524
  */
535
525
 
536
526
  declare function errorSelector<T>(message: string): RecoilValueReadOnly<T>;
537
527
 
538
528
  /**
539
- * Copyright (c) Meta Platforms, Inc. and affiliates.
540
- *
541
- * This source code is licensed under the MIT license found in the
542
- * LICENSE file in the root directory of this source tree.
543
- *
544
- * Wraps another recoil value and prevents writing to it.
545
- *
546
- * @oncall recoil
529
+ * TypeScript port of Recoil_readOnlySelector.js
547
530
  */
548
531
 
549
532
  declare function readOnlySelector<T>(atom: RecoilValue<T>): RecoilValueReadOnly<T>;
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ declare abstract class BaseLoadable<T> {
16
16
  is(other: Loadable<any>): boolean;
17
17
  }
18
18
  declare class ValueLoadable<T> extends BaseLoadable<T> {
19
- state: 'hasValue';
19
+ state: "hasValue";
20
20
  contents: T;
21
21
  constructor(value: T);
22
22
  getValue(): T;
@@ -28,7 +28,7 @@ declare class ValueLoadable<T> extends BaseLoadable<T> {
28
28
  map<S>(map: (value: T) => Promise<S> | Loadable<S> | S): Loadable<S>;
29
29
  }
30
30
  declare class ErrorLoadable<T> extends BaseLoadable<T> {
31
- state: 'hasError';
31
+ state: "hasError";
32
32
  contents: unknown;
33
33
  constructor(error: unknown);
34
34
  getValue(): T;
@@ -40,7 +40,7 @@ declare class ErrorLoadable<T> extends BaseLoadable<T> {
40
40
  map<S>(_map: (value: T) => Promise<S> | Loadable<S> | S): Loadable<S>;
41
41
  }
42
42
  declare class LoadingLoadable<T> extends BaseLoadable<T> {
43
- state: 'loading';
43
+ state: "loading";
44
44
  contents: Promise<T>;
45
45
  constructor(promise: Promise<T>);
46
46
  getValue(): T;
@@ -486,7 +486,7 @@ declare function useRecoilTransactionObserver(callback: (info: {
486
486
  declare function useRecoilSnapshot(): Snapshot;
487
487
  declare function useGotoRecoilSnapshot(): (snapshot: Snapshot) => void;
488
488
 
489
- declare function useGetRecoilValueInfo(): (<T>(recoilValue: RecoilValue<T>) => RecoilValueInfo<T>);
489
+ declare function useGetRecoilValueInfo(): <T>(recoilValue: RecoilValue<T>) => RecoilValueInfo<T>;
490
490
 
491
491
  declare function useRecoilRefresher<T>(recoilValue: RecoilValue<T>): () => void;
492
492
 
@@ -500,12 +500,7 @@ type Retainable = RecoilValue<unknown> | RetentionZone;
500
500
  declare function useRetain(retainable: Retainable): void;
501
501
 
502
502
  /**
503
- * Copyright (c) Meta Platforms, Inc. and affiliates.
504
- *
505
- * This source code is licensed under the MIT license found in the
506
- * LICENSE file in the root directory of this source tree.
507
- *
508
- * @oncall recoil
503
+ * TypeScript port of Recoil_atomFamily.js
509
504
  */
510
505
 
511
506
  type AtomFamilyOptionsWithoutDefault<T, P extends Parameter> = Readonly<AtomOptionsWithoutDefault<T> & {
@@ -513,9 +508,9 @@ type AtomFamilyOptionsWithoutDefault<T, P extends Parameter> = Readonly<AtomOpti
513
508
  retainedBy_UNSTABLE?: RetainedBy | ((param: P) => RetainedBy);
514
509
  cachePolicyForParams_UNSTABLE?: CachePolicyWithoutEviction;
515
510
  }>;
516
- type AtomFamilyOptions<T, P extends Parameter> = (Readonly<AtomFamilyOptionsWithoutDefault<T, P> & {
511
+ type AtomFamilyOptions<T, P extends Parameter> = Readonly<AtomFamilyOptionsWithoutDefault<T, P> & {
517
512
  default: RecoilValue<T> | Promise<T> | Loadable<T> | WrappedValue<T> | T | ((param: P) => T | RecoilValue<T> | Promise<T> | Loadable<T> | WrappedValue<T>);
518
- }>) | AtomFamilyOptionsWithoutDefault<T, P>;
513
+ }> | AtomFamilyOptionsWithoutDefault<T, P>;
519
514
  declare function atomFamily<T, P extends Parameter>(options: AtomFamilyOptions<T, P>): (params: P) => RecoilState<T>;
520
515
 
521
516
  /**
@@ -525,25 +520,13 @@ declare function atomFamily<T, P extends Parameter>(options: AtomFamilyOptions<T
525
520
  declare function constSelector<T extends Parameter>(constant: T): RecoilValueReadOnly<T>;
526
521
 
527
522
  /**
528
- * Copyright (c) Meta Platforms, Inc. and affiliates.
529
- *
530
- * This source code is licensed under the MIT license found in the
531
- * LICENSE file in the root directory of this source tree.
532
- *
533
- * @oncall recoil
523
+ * TypeScript port of Recoil_errorSelector.js
534
524
  */
535
525
 
536
526
  declare function errorSelector<T>(message: string): RecoilValueReadOnly<T>;
537
527
 
538
528
  /**
539
- * Copyright (c) Meta Platforms, Inc. and affiliates.
540
- *
541
- * This source code is licensed under the MIT license found in the
542
- * LICENSE file in the root directory of this source tree.
543
- *
544
- * Wraps another recoil value and prevents writing to it.
545
- *
546
- * @oncall recoil
529
+ * TypeScript port of Recoil_readOnlySelector.js
547
530
  */
548
531
 
549
532
  declare function readOnlySelector<T>(atom: RecoilValue<T>): RecoilValueReadOnly<T>;