@isograph/react-disposable-state 0.0.0-main-01f29812 → 0.0.0-main-5c978d1b
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/ParentCache.js
CHANGED
@@ -68,7 +68,7 @@ class ParentCache {
|
|
68
68
|
// typescript thinks that cacheItem is any, because it's referenced in the closure.
|
69
69
|
const [cacheItem, disposeTemporaryRetain] = pair;
|
70
70
|
this.__cacheItem = cacheItem;
|
71
|
-
return [cacheItem,
|
71
|
+
return [cacheItem, cacheItem.getValue(), disposeTemporaryRetain];
|
72
72
|
}
|
73
73
|
empty() {
|
74
74
|
this.__cacheItem = null;
|
@@ -57,6 +57,8 @@ exports.useDisposableState = useDisposableState;
|
|
57
57
|
function tsTests() {
|
58
58
|
let x;
|
59
59
|
const a = useDisposableState(x);
|
60
|
+
// This should be a compiler error, because the generic is inferred to be of
|
61
|
+
// type never. TODO determine why this doesn't break the build!
|
60
62
|
// @ts-expect-error
|
61
63
|
a.setState(['asdf', () => { }]);
|
62
64
|
// @ts-expect-error
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@isograph/react-disposable-state",
|
3
|
-
"version": "0.0.0-main-
|
3
|
+
"version": "0.0.0-main-5c978d1b",
|
4
4
|
"description": "Primitives for managing disposable state in React",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"prepack": "yarn run compile"
|
17
17
|
},
|
18
18
|
"dependencies": {
|
19
|
-
"@isograph/disposable-types": "0.0.0-main-
|
19
|
+
"@isograph/disposable-types": "0.0.0-main-5c978d1b",
|
20
20
|
"react": "^18.2.0"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
package/src/ParentCache.ts
CHANGED
@@ -79,7 +79,7 @@ export class ParentCache<T> {
|
|
79
79
|
// typescript thinks that cacheItem is any, because it's referenced in the closure.
|
80
80
|
const [cacheItem, disposeTemporaryRetain] = pair;
|
81
81
|
this.__cacheItem = cacheItem;
|
82
|
-
return [cacheItem,
|
82
|
+
return [cacheItem, cacheItem.getValue(), disposeTemporaryRetain];
|
83
83
|
}
|
84
84
|
|
85
85
|
empty() {
|
@@ -81,6 +81,8 @@ export function useDisposableState<T = never>(
|
|
81
81
|
function tsTests() {
|
82
82
|
let x: any;
|
83
83
|
const a = useDisposableState(x);
|
84
|
+
// This should be a compiler error, because the generic is inferred to be of
|
85
|
+
// type never. TODO determine why this doesn't break the build!
|
84
86
|
// @ts-expect-error
|
85
87
|
a.setState(['asdf', () => {}]);
|
86
88
|
// @ts-expect-error
|