-type HandlePromise = >(promise: P) => Awaited
-
-type CreateSnapshot = (
- target: T,
- version: number,
- handlePromise?: HandlePromise
-) => T
+type CreateSnapshot = (target: T, version: number) => T
type RemoveListener = () => void
type AddListener = (listener: Listener) => RemoveListener
@@ -86,29 +78,11 @@ const buildProxyFunction = (
!(x instanceof RegExp) &&
!(x instanceof ArrayBuffer),
- defaultHandlePromise = >(
- promise: P & {
- status?: 'pending' | 'fulfilled' | 'rejected'
- value?: Awaited
- reason?: unknown
- }
- ) => {
- switch (promise.status) {
- case 'fulfilled':
- return promise.value as Awaited
- case 'rejected':
- throw promise.reason
- default:
- throw promise
- }
- },
-
snapCache = new WeakMap