@aweebit/react-essentials 0.9.0 → 0.10.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/README.md CHANGED
@@ -2,22 +2,15 @@
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/%40aweebit%2Freact-essentials)](https://www.npmjs.com/package/@aweebit/react-essentials)
4
4
 
5
- ### Requirements
6
-
7
- - React ≥ 18
8
- - TypeScript ≥ 5.4
9
-
10
- ### Functions
11
-
12
5
  - [useEventListener()](#useeventlistener)
13
6
  - [useReducerWithDeps()](#usereducerwithdeps)
14
7
  - [useStateWithDeps()](#usestatewithdeps)
15
8
  - [createSafeContext()](#createsafecontext)
16
9
 
17
- ### Types
10
+ ### Requirements
18
11
 
19
- - [UseEventListener](#useeventlistener-1)
20
- - [SafeContext](#safecontext)
12
+ - React ≥ 18
13
+ - TypeScript ≥ 5.4
21
14
 
22
15
  ## useEventListener
23
16
 
@@ -25,7 +18,7 @@
25
18
  const useEventListener: UseEventListener;
26
19
  ```
27
20
 
28
- Defined in: [hooks/useEventListener.ts:135](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L135)
21
+ Defined in: [hooks/useEventListener.ts:135](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L135)
29
22
 
30
23
  Adds `handler` as a listener for the event `eventName` of `target` with the
31
24
  provided `options` applied
@@ -76,7 +69,7 @@ function useReducerWithDeps<S, A>(
76
69
  ): [S, ActionDispatch<A>];
77
70
  ```
78
71
 
79
- Defined in: [hooks/useReducerWithDeps.ts:59](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useReducerWithDeps.ts#L59)
72
+ Defined in: [hooks/useReducerWithDeps.ts:59](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useReducerWithDeps.ts#L59)
80
73
 
81
74
  `useReducer` hook with an additional dependency array `deps` that resets the
82
75
  state to `initialState` when dependencies change
@@ -219,7 +212,7 @@ function useStateWithDeps<S>(
219
212
  ): [S, Dispatch<SetStateAction<S>>];
220
213
  ```
221
214
 
222
- Defined in: [hooks/useStateWithDeps.ts:62](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useStateWithDeps.ts#L62)
215
+ Defined in: [hooks/useStateWithDeps.ts:62](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useStateWithDeps.ts#L62)
223
216
 
224
217
  `useState` hook with an additional dependency array `deps` that resets the
225
218
  state to `initialState` when dependencies change
@@ -348,10 +341,12 @@ Dependencies that reset the state to `initialState`
348
341
  ```ts
349
342
  function createSafeContext<T>(): <DisplayName>(
350
343
  displayName,
351
- ) => SafeContext<DisplayName, T>;
344
+ ) => { [K in `${string}Context`]: Context<T> } & {
345
+ [K in `use${string}`]: () => T;
346
+ };
352
347
  ```
353
348
 
354
- Defined in: [misc/createSafeContext.ts:95](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/misc/createSafeContext.ts#L95)
349
+ Defined in: [misc/createSafeContext.ts:62](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/misc/createSafeContext.ts#L62)
355
350
 
356
351
  For a given type `T`, returns a function that produces both a context of that
357
352
  type and a hook that returns the current context value if one was provided,
@@ -437,7 +432,7 @@ A function that accepts a single string argument `displayName` (e.g.
437
432
  current context value if one was provided, or throws an error otherwise
438
433
 
439
434
  ```ts
440
- <DisplayName>(displayName): SafeContext<DisplayName, T>;
435
+ <DisplayName>(displayName): { [K in `${string}Context`]: Context<T> } & { [K in `use${string}`]: () => T };
441
436
  ```
442
437
 
443
438
  #### Type Parameters
@@ -486,11 +481,7 @@ A function that accepts a single string argument `displayName` (e.g.
486
481
 
487
482
  #### Returns
488
483
 
489
- [`SafeContext`](#safecontext)\<`DisplayName`, `T`\>
490
-
491
- ### See
492
-
493
- [`SafeContext`](#safecontext)
484
+ ``{ [K in `${string}Context`]: Context<T> }`` & ``{ [K in `use${string}`]: () => T }``
494
485
 
495
486
  ---
496
487
 
@@ -502,7 +493,7 @@ type UseEventListener = UseEventListenerWithImplicitWindowTarget &
502
493
  UseEventListenerWithAnyExplicitTarget;
503
494
  ```
504
495
 
505
- Defined in: [hooks/useEventListener.ts:12](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L12)
496
+ Defined in: [hooks/useEventListener.ts:12](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L12)
506
497
 
507
498
  The type of [`useEventListener`](#useeventlistener-1)
508
499
 
@@ -521,7 +512,7 @@ The type of [`useEventListener`](#useeventlistener-1)
521
512
  type UseEventListenerWithImplicitWindowTarget = <K>(...args) => void;
522
513
  ```
523
514
 
524
- Defined in: [hooks/useEventListener.ts:21](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L21)
515
+ Defined in: [hooks/useEventListener.ts:21](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L21)
525
516
 
526
517
  ### Type Parameters
527
518
 
@@ -589,7 +580,7 @@ type UseEventListenerWithExplicitGlobalTarget =
589
580
  UseEventListenerWithExplicitTarget<MathMLElement, MathMLElementEventMap>;
590
581
  ```
591
582
 
592
- Defined in: [hooks/useEventListener.ts:32](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L32)
583
+ Defined in: [hooks/useEventListener.ts:32](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L32)
593
584
 
594
585
  ### See
595
586
 
@@ -606,7 +597,7 @@ type UseEventListenerWithExplicitTarget<Target, EventMap> = <T, K>(
606
597
  ) => void;
607
598
  ```
608
599
 
609
- Defined in: [hooks/useEventListener.ts:44](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L44)
600
+ Defined in: [hooks/useEventListener.ts:44](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L44)
610
601
 
611
602
  ### Type Parameters
612
603
 
@@ -705,7 +696,7 @@ type UseEventListenerWithAnyExplicitTarget = UseEventListenerWithExplicitTarget<
705
696
  >;
706
697
  ```
707
698
 
708
- Defined in: [hooks/useEventListener.ts:56](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L56)
699
+ Defined in: [hooks/useEventListener.ts:56](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L56)
709
700
 
710
701
  ### See
711
702
 
@@ -726,7 +717,7 @@ type UseEventListenerWithImplicitWindowTargetArgs<K> =
726
717
  : never;
727
718
  ```
728
719
 
729
- Defined in: [hooks/useEventListener.ts:64](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L64)
720
+ Defined in: [hooks/useEventListener.ts:64](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L64)
730
721
 
731
722
  ### Type Parameters
732
723
 
@@ -771,7 +762,7 @@ type UseEventListenerWithExplicitTargetArgs<EventMap, T, K> = [
771
762
  ];
772
763
  ```
773
764
 
774
- Defined in: [hooks/useEventListener.ts:78](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/hooks/useEventListener.ts#L78)
765
+ Defined in: [hooks/useEventListener.ts:78](https://github.com/aweebit/react-essentials/blob/v0.10.0/src/hooks/useEventListener.ts#L78)
775
766
 
776
767
  ### Type Parameters
777
768
 
@@ -809,95 +800,3 @@ Defined in: [hooks/useEventListener.ts:78](https://github.com/aweebit/react-esse
809
800
  ### See
810
801
 
811
802
  [`useEventListener`](#useeventlistener-1)
812
-
813
- ---
814
-
815
- ## SafeContext
816
-
817
- ```ts
818
- type SafeContext<DisplayName, T> = {
819
- [K in `${DisplayName}Context`]: RestrictedContext<T>;
820
- } & { [K in `use${DisplayName}`]: () => T };
821
- ```
822
-
823
- Defined in: [misc/createSafeContext.ts:13](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/misc/createSafeContext.ts#L13)
824
-
825
- The return type of [`createSafeContext`](#createsafecontext)
826
-
827
- ### Type Parameters
828
-
829
- <table>
830
- <thead>
831
- <tr>
832
- <th>Type Parameter</th>
833
- </tr>
834
- </thead>
835
- <tbody>
836
- <tr>
837
- <td>
838
-
839
- `DisplayName` _extends_ `string`
840
-
841
- </td>
842
- </tr>
843
- <tr>
844
- <td>
845
-
846
- `T`
847
-
848
- </td>
849
- </tr>
850
- </tbody>
851
- </table>
852
-
853
- ### See
854
-
855
- [`createSafeContext`](#createsafecontext),
856
- [`RestrictedContext`](#restrictedcontext)
857
-
858
- ---
859
-
860
- ## RestrictedContext
861
-
862
- ```ts
863
- type RestrictedContext<T> =
864
- Context<T> extends Provider<T>
865
- ? {
866
- Provider: Provider<T>;
867
- displayName: string;
868
- } & Provider<T>
869
- : {
870
- Provider: Provider<T>;
871
- displayName: string;
872
- };
873
- ```
874
-
875
- Defined in: [misc/createSafeContext.ts:31](https://github.com/aweebit/react-essentials/blob/v0.9.0/src/misc/createSafeContext.ts#L31)
876
-
877
- A React context with a required `displayName` and the obsolete `Consumer`
878
- property purposefully omitted so that it is impossible to pass the context
879
- as an argument to `useContext` or `use` (the hook produced with
880
- [`createSafeContext`](#createsafecontext) should be used instead)
881
-
882
- ### Type Parameters
883
-
884
- <table>
885
- <thead>
886
- <tr>
887
- <th>Type Parameter</th>
888
- </tr>
889
- </thead>
890
- <tbody>
891
- <tr>
892
- <td>
893
-
894
- `T`
895
-
896
- </td>
897
- </tr>
898
- </tbody>
899
- </table>
900
-
901
- ### See
902
-
903
- [`createSafeContext`](#createsafecontext)
@@ -1,33 +1,5 @@
1
- import { type Context, type Provider } from 'react';
1
+ import { type Context } from 'react';
2
2
  import type { ArgumentFallback } from '../utils.js';
3
- /**
4
- * The return type of {@linkcode createSafeContext}
5
- *
6
- * @see
7
- * {@linkcode createSafeContext},
8
- * {@linkcode RestrictedContext}
9
- */
10
- export type SafeContext<DisplayName extends string, T> = {
11
- [K in `${DisplayName}Context`]: RestrictedContext<T>;
12
- } & {
13
- [K in `use${DisplayName}`]: () => T;
14
- };
15
- /**
16
- * A React context with a required `displayName` and the obsolete `Consumer`
17
- * property purposefully omitted so that it is impossible to pass the context
18
- * as an argument to `useContext` or `use` (the hook produced with
19
- * {@linkcode createSafeContext} should be used instead)
20
- *
21
- * @see
22
- * {@linkcode createSafeContext}
23
- */
24
- export type RestrictedContext<T> = Context<T> extends Provider<T> ? {
25
- Provider: Provider<T>;
26
- displayName: string;
27
- } & Provider<T> : {
28
- Provider: Provider<T>;
29
- displayName: string;
30
- };
31
3
  /**
32
4
  * For a given type `T`, returns a function that produces both a context of that
33
5
  * type and a hook that returns the current context value if one was provided,
@@ -83,9 +55,6 @@ export type RestrictedContext<T> = Context<T> extends Provider<T> ? {
83
55
  * - ``` `${displayName}Context` ``` (e.g. `DirectionContext`): the context
84
56
  * - ``` `use${displayName}` ``` (e.g. `useDirection`): a hook that returns the
85
57
  * current context value if one was provided, or throws an error otherwise
86
- *
87
- * @see
88
- * {@linkcode SafeContext}
89
58
  */
90
- export declare function createSafeContext<T = never>(): <DisplayName extends string>(displayName: [T] extends [never] ? never : ArgumentFallback<DisplayName, never, string>) => SafeContext<DisplayName, T>;
59
+ export declare function createSafeContext<T = never>(): <DisplayName extends string>(displayName: [T] extends [never] ? never : ArgumentFallback<DisplayName, never, string>) => { [K in `${DisplayName}Context`]: Context<T>; } & { [K in `use${DisplayName}`]: () => T; };
91
60
  //# sourceMappingURL=createSafeContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSafeContext.d.ts","sourceRoot":"","sources":["../../src/misc/createSafeContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAA6B,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CAAC,WAAW,SAAS,MAAM,EAAE,CAAC,IAAI;KACtD,CAAC,IAAI,GAAG,WAAW,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC;CACrD,GAAG;KACD,CAAC,IAAI,MAAM,WAAW,EAAE,GAAG,MAAM,CAAC;CACpC,CAAC;AAEF;;;;;;;;GAQG;AAIH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAC7B,OAAO,CAAC,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,GAC1B;IAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,GAC5D;IAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,KAAK,MACjC,WAAW,SAAS,MAAM,EAChC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC5B,KAAK,GACL,gBAAgB,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,KAC/C,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAsB/B"}
1
+ {"version":3,"file":"createSafeContext.d.ts","sourceRoot":"","sources":["../../src/misc/createSafeContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAA6B,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,KAAK,MACjC,WAAW,SAAS,MAAM,EAChC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC5B,KAAK,GACL,gBAAgB,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,KAC/C,GAAG,CAAC,IAAI,GAAG,WAAW,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,GAAE,GAAG,GACjD,CAAC,IAAI,MAAM,WAAW,EAAE,GAAG,MAAM,CAAC,GACpC,CAsBF"}
@@ -55,9 +55,6 @@ const moValueSymbol = Symbol('noValue');
55
55
  * - ``` `${displayName}Context` ``` (e.g. `DirectionContext`): the context
56
56
  * - ``` `use${displayName}` ``` (e.g. `useDirection`): a hook that returns the
57
57
  * current context value if one was provided, or throws an error otherwise
58
- *
59
- * @see
60
- * {@linkcode SafeContext}
61
58
  */
62
59
  export function createSafeContext() {
63
60
  return (displayName) => {
@@ -1 +1 @@
1
- {"version":3,"file":"createSafeContext.js","sourceRoot":"","sources":["../../src/misc/createSafeContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG/E,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAgCxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CACL,WAEgD,EACnB,EAAE;QAC/B,MAAM,WAAW,GAAG,GAAG,WAA0B,SAAkB,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,WAA0B,EAAW,CAAC;QAE7D,MAAM,OAAO,GAAG,aAAa,CAA2B,aAAa,CAAC,CAAC;QACvE,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;QAElC,OAAO;YACL,CAAC,WAAW,CAAC,EAAE,OAA+B;YAC9C,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;gBACf,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;gBAClC,IAAI,KAAK,KAAK,aAAa,EAAE,CAAC;oBAC5B,MAAM,IAAI,KAAK,CAAC,MAAM,WAAW,qBAAqB,CAAC,CAAC;gBAC1D,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SAKF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"createSafeContext.js","sourceRoot":"","sources":["../../src/misc/createSafeContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGhE,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CACL,WAEgD,EAGhD,EAAE;QACF,MAAM,WAAW,GAAG,GAAG,WAA0B,SAAkB,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,WAA0B,EAAW,CAAC;QAE7D,MAAM,OAAO,GAAG,aAAa,CAA2B,aAAa,CAAC,CAAC;QACvE,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;QAElC,OAAO;YACL,CAAC,WAAW,CAAC,EAAE,OAAqB;YACpC,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE;gBACf,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;gBAClC,IAAI,KAAK,KAAK,aAAa,EAAE,CAAC;oBAC5B,MAAM,IAAI,KAAK,CAAC,MAAM,WAAW,qBAAqB,CAAC,CAAC;gBAC1D,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SAKF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aweebit/react-essentials",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "repository": "github:aweebit/react-essentials",
6
6
  "main": "dist/index.js",
@@ -1,38 +1,8 @@
1
- import { type Context, type Provider, createContext, useContext } from 'react';
1
+ import { type Context, createContext, useContext } from 'react';
2
2
  import type { ArgumentFallback } from '../utils.js';
3
3
 
4
4
  const moValueSymbol = Symbol('noValue');
5
5
 
6
- /**
7
- * The return type of {@linkcode createSafeContext}
8
- *
9
- * @see
10
- * {@linkcode createSafeContext},
11
- * {@linkcode RestrictedContext}
12
- */
13
- export type SafeContext<DisplayName extends string, T> = {
14
- [K in `${DisplayName}Context`]: RestrictedContext<T>;
15
- } & {
16
- [K in `use${DisplayName}`]: () => T;
17
- };
18
-
19
- /**
20
- * A React context with a required `displayName` and the obsolete `Consumer`
21
- * property purposefully omitted so that it is impossible to pass the context
22
- * as an argument to `useContext` or `use` (the hook produced with
23
- * {@linkcode createSafeContext} should be used instead)
24
- *
25
- * @see
26
- * {@linkcode createSafeContext}
27
- */
28
- // The type is conditional so that both React 18 and 19 are correctly supported.
29
- // The code duplication is necessary for the type to be displayed correctly by
30
- // TypeDoc.
31
- export type RestrictedContext<T> =
32
- Context<T> extends Provider<T>
33
- ? { Provider: Provider<T>; displayName: string } & Provider<T>
34
- : { Provider: Provider<T>; displayName: string };
35
-
36
6
  /**
37
7
  * For a given type `T`, returns a function that produces both a context of that
38
8
  * type and a hook that returns the current context value if one was provided,
@@ -88,16 +58,15 @@ export type RestrictedContext<T> =
88
58
  * - ``` `${displayName}Context` ``` (e.g. `DirectionContext`): the context
89
59
  * - ``` `use${displayName}` ``` (e.g. `useDirection`): a hook that returns the
90
60
  * current context value if one was provided, or throws an error otherwise
91
- *
92
- * @see
93
- * {@linkcode SafeContext}
94
61
  */
95
62
  export function createSafeContext<T = never>() {
96
63
  return <DisplayName extends string>(
97
64
  displayName: [T] extends [never]
98
65
  ? never
99
66
  : ArgumentFallback<DisplayName, never, string>,
100
- ): SafeContext<DisplayName, T> => {
67
+ ): { [K in `${DisplayName}Context`]: Context<T> } & {
68
+ [K in `use${DisplayName}`]: () => T;
69
+ } => {
101
70
  const contextName = `${displayName as DisplayName}Context` as const;
102
71
  const hookName = `use${displayName as DisplayName}` as const;
103
72
 
@@ -105,7 +74,7 @@ export function createSafeContext<T = never>() {
105
74
  Context.displayName = contextName;
106
75
 
107
76
  return {
108
- [contextName]: Context as RestrictedContext<T>,
77
+ [contextName]: Context as Context<T>,
109
78
  [hookName]: () => {
110
79
  const value = useContext(Context);
111
80
  if (value === moValueSymbol) {
@@ -114,7 +83,7 @@ export function createSafeContext<T = never>() {
114
83
  return value;
115
84
  },
116
85
  } as {
117
- [K in typeof contextName]: RestrictedContext<T>;
86
+ [K in typeof contextName]: Context<T>;
118
87
  } & {
119
88
  [K in typeof hookName]: () => T;
120
89
  };