Not sure why only in Fedora (typescript version is 5.1.3), but I managed to fix these errors.
I know why this happens, it's because of the typescript version, alternative solution in this other PR #333
Apparently, all tuple members must have names (or no names)
../src/utils/binding.ts(35,62): error TS5084: Tuple members must all have names or all not have names.
../src/utils/binding.ts(40,46): error TS5084: Tuple members must all have names or all not have names.
- [Connectable, signal?: string]
+ [obj: Connectable, signal?: string]
It assumes that empty array [] to be of type never[], and for some reason it says "reduce" isn't callable? This can be fixed by using new Array instead of [] (but the linter complains about it) or just define the type to be any[].
../src/widgets/widget.ts(249,29): error TS2349: This expression is not callable.
Each member of the union type '{ (callbackfn: (previousValue: "SHIFT" | "LOCK" | "CONTROL" | "MOD1" | "MOD2" | "MOD3" | "MOD4" | "MOD5" | "BUTTON1" | "BUTTON2" | "BUTTON3" | "BUTTON4" | "BUTTON5" | "MODIFIER_RESERVED_13" | "MODIFIER_RESERVED_14" | ... 16 more ... | "MODIFIER", currentValue: "SHIFT" | ... 30 more ... | "MODIFIER", currentIndex: nu...' has signatures, but none of those signatures are compatible with each other.
../src/widgets/widget.ts(249,37): error TS7006: Parameter 'ms' implicitly has an 'any' type.
../src/widgets/widget.ts(249,41): error TS7006: Parameter 'm' implicitly has an 'any' type.
- const mods = callback ? modsOrKey as Mod : [];
+ const mods = callback ? modsOrKey as Mod : [] as any[];
This one complains that the index `${m}_MASK` isn't a number...
../src/widgets/widget.ts(249,69): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
- const ms = mods.reduce((ms, m) => ms | Gdk.ModifierType[`${m}_MASK`], 0);
+ const ms = mods.reduce(
+ (ms, m) => ms | Gdk.ModifierType[`${m}_MASK` as keyof typeof Gdk.ModifierType],
+ 0,
+ );
Fixes #312 (typescript errors)
Not sure why only in Fedora (typescript version is 5.1.3), but I managed to fix these errors.I know why this happens, it's because of the typescript version, alternative solution in this other PR #333Apparently, all tuple members must have names (or no names)
It assumes that empty array [] to be of type never[], and for some reason it says "reduce" isn't callable? This can be fixed by using
new Array
instead of [] (but the linter complains about it) or just define the type to be any[].This one complains that the index `${m}_MASK` isn't a number...