@dr.pogodin/react-global-state 0.15.0 → 0.16.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/build/common/GlobalState.js.map +1 -1
- package/build/common/GlobalStateProvider.js +5 -4
- package/build/common/GlobalStateProvider.js.map +1 -1
- package/build/common/index.js +12 -21
- package/build/common/index.js.map +1 -1
- package/build/common/useAsyncCollection.js +190 -44
- package/build/common/useAsyncCollection.js.map +1 -1
- package/build/common/useAsyncData.js +49 -59
- package/build/common/useAsyncData.js.map +1 -1
- package/build/common/useGlobalState.js.map +1 -1
- package/build/module/GlobalState.js.map +1 -1
- package/build/module/GlobalStateProvider.js +3 -2
- package/build/module/GlobalStateProvider.js.map +1 -1
- package/build/module/index.js +1 -2
- package/build/module/index.js.map +1 -1
- package/build/module/useAsyncCollection.js +208 -45
- package/build/module/useAsyncCollection.js.map +1 -1
- package/build/module/useAsyncData.js +49 -60
- package/build/module/useAsyncData.js.map +1 -1
- package/build/module/useGlobalState.js.map +1 -1
- package/build/types/GlobalStateProvider.d.ts +2 -2
- package/build/types/index.d.ts +3 -4
- package/build/types/useAsyncCollection.d.ts +29 -46
- package/build/types/useAsyncData.d.ts +28 -46
- package/build/types/useGlobalState.d.ts +2 -0
- package/package.json +17 -16
- package/src/GlobalState.ts +5 -5
- package/src/GlobalStateProvider.tsx +5 -5
- package/src/index.ts +12 -2
- package/src/useAsyncCollection.ts +355 -64
- package/src/useAsyncData.ts +66 -76
- package/src/useGlobalState.ts +13 -0
- package/tsconfig.json +4 -4
package/src/useGlobalState.ts
CHANGED
|
@@ -99,6 +99,14 @@ function useGlobalState<
|
|
|
99
99
|
function useGlobalState<StateT>(): UseGlobalStateResT<StateT>;
|
|
100
100
|
|
|
101
101
|
// "State evaluation overload"
|
|
102
|
+
function useGlobalState<
|
|
103
|
+
StateT,
|
|
104
|
+
PathT extends null | string | undefined,
|
|
105
|
+
>(
|
|
106
|
+
path: PathT,
|
|
107
|
+
initialValue: ValueOrInitializerT<Exclude<ValueAtPathT<StateT, PathT, never>, undefined>>
|
|
108
|
+
): UseGlobalStateResT<Exclude<ValueAtPathT<StateT, PathT, void>, undefined>>;
|
|
109
|
+
|
|
102
110
|
function useGlobalState<
|
|
103
111
|
StateT,
|
|
104
112
|
PathT extends null | string | undefined,
|
|
@@ -193,6 +201,11 @@ export default useGlobalState;
|
|
|
193
201
|
export interface UseGlobalStateI<StateT> {
|
|
194
202
|
(): UseGlobalStateResT<StateT>;
|
|
195
203
|
|
|
204
|
+
<PathT extends null | string | undefined>(
|
|
205
|
+
path: PathT,
|
|
206
|
+
initialValue: ValueOrInitializerT<Exclude<ValueAtPathT<StateT, PathT, never>, undefined>>
|
|
207
|
+
): UseGlobalStateResT<Exclude<ValueAtPathT<StateT, PathT, void>, undefined>>;
|
|
208
|
+
|
|
196
209
|
<PathT extends null | string | undefined>(
|
|
197
210
|
path: PathT,
|
|
198
211
|
initialValue?: ValueOrInitializerT<ValueAtPathT<StateT, PathT, never>>
|
package/tsconfig.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"jsx": "react-jsx",
|
|
6
6
|
"module": "ESNext",
|
|
7
7
|
"moduleResolution": "Node",
|
|
8
|
+
"noUncheckedIndexedAccess": true,
|
|
8
9
|
"outDir": "build",
|
|
9
10
|
"paths": {
|
|
10
|
-
"*": ["./*"]
|
|
11
|
+
"*": ["./*"]
|
|
11
12
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
},
|
|
13
|
+
"verbatimModuleSyntax": true
|
|
14
|
+
}
|
|
15
15
|
}
|