]> git.ardis.lu - csvio/commitdiff
Fix `createProxy` type templates
authorArdis Lu <ardisglu@gmail.com>
Tue, 5 Aug 2025 06:13:47 +0000 (23:13 -0700)
committerArdis Lu <ardisglu@gmail.com>
Tue, 5 Aug 2025 06:13:47 +0000 (23:13 -0700)
src/core.js

index e42d5a57743c0c1a97ef7f20c58b3475679d2288..9d833d660c55e0911da752d5e86cc590b342b5f6 100644 (file)
@@ -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);
     }
-  });
+  }));
 }
 
 /**
This page took 0.042568 seconds and 4 git commands to generate.