From efe95df03cd71ee9ceb2ed2709018b4d7843bcbc Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Mon, 4 Aug 2025 23:13:47 -0700 Subject: [PATCH] Fix `createProxy` type templates --- src/core.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core.js b/src/core.js index e42d5a5..9d833d6 100644 --- a/src/core.js +++ b/src/core.js @@ -86,20 +86,21 @@ export function createFileStream(path) { * Creates a simple `Proxy` that tries property access on `primary` and falls back to `underlying` if the property * does not exist in `primary`. Only the `get` trap is implemented. * - * @template T, U + * @template {Object} T + * @template {Object} U * @param {T} primary The primary target object of the proxy. * @param {U} underlying The fallback object to proxy property accesses to if not found on `primary`. * @returns {T&U} A `Proxy` that behaves like `primary`, with fallback to `underlying` for missing properties. */ function createProxy(primary, underlying) { - return new Proxy(primary, { + return /** @type {T&U} */(new Proxy(primary, { get(target, prop, receiver) { if (prop in target) { return Reflect.get(target, prop, receiver); } return Reflect.get(underlying, prop, receiver); } - }); + })); } /** -- 2.47.3