Description: workaround TypeScript >= 5.1 narrowing change (tsc error TS2538)
 The type guard JSONExt.isObject(key) with `key` declared as `string | {}`
 narrows `key` to `{}` in the else branch with TypeScript >= 5.1, so
 `(attrs = {} as ObjectHash)[key]` fails to compile with:
   src/backbone-patch.ts(63,32): error TS2538: Type '{}' cannot be used as an index type.
 Add an explicit `as string` cast so that packages/base compiles with the
 node-typescript 5.x shipped in openKylin (upstream pins typescript ~4.9.4).
Origin: debian, ipywidgets 8.1.5-7 (debian/patches/0003-tsc-5-1.patch)
Bug: https://bugs.debian.org/1114155
Forwarded: no
Author: Jérémy Lal <kapouer@melix.org>
Last-Update: 2026-03-11

--- a/packages/base/src/backbone-patch.ts
+++ b/packages/base/src/backbone-patch.ts
@@ -60,7 +60,7 @@ export function set(
     attrs = key;
     options = val;
   } else {
-    (attrs = {} as ObjectHash)[key] = val;
+    (attrs = {} as ObjectHash)[key as string] = val;
   }
 
   options || (options = {});
