From: Ardis Lu Date: Tue, 5 Aug 2025 06:13:47 +0000 (-0700) Subject: Fix `createProxy` type templates X-Git-Tag: v0.1.5~11 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=efe95df03cd71ee9ceb2ed2709018b4d7843bcbc;p=csvio Fix `createProxy` type templates --- 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); } - }); + })); } /**