[Scummvm-git-logs] scummvm-web master -> a90df4e1ceacded1a96dca71e6c0a41dab8fd497

lephilousophe noreply at scummvm.org
Sun Apr 5 11:06:23 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://api.github.com/repos/scummvm/scummvm-web .

Summary:
a90df4e1ce DUMPER-COMPANION: More typescript fixes


Commit: a90df4e1ceacded1a96dca71e6c0a41dab8fd497
    https://github.com/scummvm/scummvm-web/commit/a90df4e1ceacded1a96dca71e6c0a41dab8fd497
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-04-05T13:04:04+02:00

Commit Message:
DUMPER-COMPANION: More typescript fixes

Changed paths:
    dumper-companion/package-lock.json
    dumper-companion/package.json
    dumper-companion/src/Dumper.tsx
    dumper-companion/src/encoding.ts
    dumper-companion/src/hfs/directory.ts
    dumper-companion/src/hfs/main.ts
    dumper-companion/src/index.tsx
    dumper-companion/src/util.ts


diff --git a/dumper-companion/package-lock.json b/dumper-companion/package-lock.json
index e5630eea..504869b1 100644
--- a/dumper-companion/package-lock.json
+++ b/dumper-companion/package-lock.json
@@ -8,6 +8,7 @@
       "name": "dumper-companion",
       "version": "0.0.1",
       "dependencies": {
+        "@types/punycode": "^2.1.4",
         "@zip.js/zip.js": "^2.8.26",
         "preact": "^10.29.0",
         "punycode": "^2.3.1",
@@ -18,7 +19,6 @@
       "devDependencies": {
         "@eslint/js": "^9.39.1",
         "@stylistic/eslint-plugin": "^5.7.1",
-        "@types/punycode": "^2.1.4",
         "eslint": "^9.39.1",
         "eslint-config-preact": "^2.0.0",
         "globals": "^17.3.0",
@@ -714,7 +714,6 @@
       "version": "2.1.4",
       "resolved": "https://registry.npmjs.org/@types/punycode/-/punycode-2.1.4.tgz",
       "integrity": "sha512-trzh6NzBnq8yw5e35f8xe8VTYjqM3NE7bohBtvDVf/dtUer3zYTLK1Ka3DG3p7bdtoaOHZucma6FfVKlQ134pQ==",
-      "dev": true,
       "license": "MIT"
     },
     "node_modules/@typescript-eslint/eslint-plugin": {
diff --git a/dumper-companion/package.json b/dumper-companion/package.json
index 8e246b2a..b1037157 100644
--- a/dumper-companion/package.json
+++ b/dumper-companion/package.json
@@ -10,6 +10,7 @@
     "@zip.js/zip.js": "^2.8.26",
     "preact": "^10.29.0",
     "punycode": "^2.3.1",
+    "@types/punycode": "^2.1.4",
     "ts-loader": "^9.5.7",
     "webpack": "^5.105.4",
     "webpack-cli": "^7.0.2"
@@ -20,7 +21,6 @@
     "eslint": "^9.39.1",
     "eslint-config-preact": "^2.0.0",
     "globals": "^17.3.0",
-    "typescript-eslint": "^8.54.0",
-    "@types/punycode": "^2.1.4"
+    "typescript-eslint": "^8.54.0"
   }
 }
diff --git a/dumper-companion/src/Dumper.tsx b/dumper-companion/src/Dumper.tsx
index 1259a52e..faa1751c 100644
--- a/dumper-companion/src/Dumper.tsx
+++ b/dumper-companion/src/Dumper.tsx
@@ -44,8 +44,8 @@ async function dumpVolume(file: ArrayBuffer, s: DumpSettings): Promise<void> {
 
 export default function Dumper() {
     type Image = {
-        file: File;
-        name: string;
+        file: File | null;
+        name: string | null;
     };
 
     type Progress = {
@@ -103,7 +103,11 @@ export default function Dumper() {
     }
 
     function handleImage(e: Event): void {
-        const file = (e.target as HTMLInputElement).files[0];
+        const files = (e.target as HTMLInputElement).files;
+        if (!files) {
+            return;
+        }
+        const file = files[0];
         const name = file.name.replace(/\.\w+$/, '');
         setImage({file, name});
     }
@@ -124,6 +128,9 @@ export default function Dumper() {
     }}
 
     function handleDump(): void {
+        if (!image.file) {
+            return;
+        }
         starting();
         log(`Loading volume "${image.name}"...`);
         const reader = new FileReader();
diff --git a/dumper-companion/src/encoding.ts b/dumper-companion/src/encoding.ts
index a104de84..8b83d683 100644
--- a/dumper-companion/src/encoding.ts
+++ b/dumper-companion/src/encoding.ts
@@ -20,12 +20,12 @@ export enum Language {
 
 export function getLanguages(): string[] {
     return Object.keys(Language).map(
-        // Typecast to string as the key obviously exists
-        (key: string): string => Language[key] as string);
+        // Typecast to keyof as the key obviously exists
+        (key: string): string => Language[key as keyof typeof Language]);
 }
 
 
-export function decodeLanguage(str: Uint8Array, lang: Language, log: (string) => void): string {
+export function decodeLanguage(str: Uint8Array, lang: Language, log: (_:string) => void): string {
     switch (lang) {
     case Language.DA:
     case Language.NL:
@@ -92,7 +92,7 @@ function needsPunycode(str: string) {
 }
 
 
-export function encodeFileName(str: Uint8Array, lang: Language, puny: boolean, log: (string) => void): string {
+export function encodeFileName(str: Uint8Array, lang: Language, puny: boolean, log: (_:string) => void): string {
     const unicodeStr = decodeLanguage(str, lang, log);
 
     const forcePunycode = needsPunycode(unicodeStr);
@@ -138,7 +138,7 @@ export function decodeMacRoman(str: Uint8Array): string {
  */
 
 /* eslint-disable no-sparse-arrays */
-const macJapaneseMap: Record<string, string[]> = {
+const macJapaneseMap: Record<string, (string | undefined)[]> = {
     '81': [' ','、','。',',','.','・',':',';','?','!','゛','゜','´','`','¨','^',' ̄','_','ヽ','ヾ','ゝ','ゞ','〃','仝','々','〆','〇','ー','—','‐','/','\','〜','‖','|','…','‥','‘','’','“','”','(',')','〔','〕','[',']','{','}','〈','〉','《','》','「','」','『','』','【','】','+','−','±','×',,'÷','=','≠','<','>','≦','≧','∞','∴','♂','♀','°','′','″','℃','¥','$','¢','£','%','#','&','*','@','§','☆','★','○','●','◎','◇','◆','□','■','△','▲','▽','▼','※','〒','→','←','↑','↓','〓',,,,,,,,,,,,'∈','∋','⊆','⊇','⊂','⊃','∪','∩',,,,,,,,,'∧','∨','¬','⇒','⇔','∀','∃',,,,,,,,,,,,'∠','⊥','⌒','∂','∇','≡','≒','≪','≫','√','∽','∝','∵','∫','∬',,,,,,,,'Å','‰','♯','♭','♪','†','‡','¶',,,,,'◯'],
     '82': [,,,,,,,,,,,,,,,'0','1','2','3','4','5','6','7','8','9',,,,,,,,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',,,,,,,,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',,,,,'ぁ','あ','ぃ','い','ぅ','う','ぇ','え','ぉ','お','か','が','き','ぎ','く','ぐ','け','げ','こ','ご','さ','ざ','し','じ','す','ず','せ','ぜ','そ','ぞ','た','だ','ち','ぢ','っ','つ','づ','て','で','と','ど','な','に','ぬ','ね','の','は','ば','ぱ','ひ','び','ぴ','ふ','ぶ','ぷ','へ','べ','ぺ','ほ','ぼ','ぽ','ま','み','む','め','も','ゃ','や','ゅ','ゆ','ょ','よ','ら','り','る','れ','ろ','ゎ','わ','ゐ','ゑ','を','ん'],
     '83': ['ァ','ア','ィ','イ','ゥ','ウ','ェ','エ','ォ','オ','カ','ガ','キ','ギ','ク','グ','ケ','ゲ','コ','ゴ','サ','ザ','シ','ジ','ス','ズ','セ','ゼ','ソ','ゾ','タ','ダ','チ','ヂ','ッ','ツ','ヅ','テ','デ','ト','ド','ナ','ニ','ヌ','ネ','ノ','ハ','バ','パ','ヒ','ビ','ピ','フ','ブ','プ','ヘ','ベ','ペ','ホ','ボ','ポ','マ','ミ',,'ム','メ','モ','ャ','ヤ','ュ','ユ','ョ','ヨ','ラ','リ','ル','レ','ロ','ヮ','ワ','ヰ','ヱ','ヲ','ン','ヴ','ヵ','ヶ',,,,,,,,,'Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ','Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ','Χ','Ψ','Ω',,,,,,,,,'α','β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ','ν','ξ','ο','π','ρ','σ','τ','υ','φ','χ','ψ','ω'],
@@ -187,7 +187,7 @@ const macJapaneseMap: Record<string, string[]> = {
 };
 /* eslint-enable no-sparse-arrays */
 
-export function decodeMacJapanese(str: Uint8Array, log: (string) => void): string {
+export function decodeMacJapanese(str: Uint8Array, log: (_:string) => void): string {
     let res = '';
     for (let i = 0; i < str.length; i++) {
         const hi = str[i];
diff --git a/dumper-companion/src/hfs/directory.ts b/dumper-companion/src/hfs/directory.ts
index 4be418df..0970da77 100644
--- a/dumper-companion/src/hfs/directory.ts
+++ b/dumper-companion/src/hfs/directory.ts
@@ -85,14 +85,14 @@ export class AbstractFolder {
             res.push([[name], child]);
             if (child instanceof AbstractFolder) {
                 for (const [each_path, each_child] of child.iter_paths()) {
-                    res.push([[].concat(name, each_path), each_child]);
+                    res.push([(<Uint8Array[]>[]).concat(name, each_path), each_child]);
                 }
             }
         }
         return res;
     }
 
-    dumpToZip(zipDir: ZipDirectoryEntry, lang: Language, puny: boolean, forceMacBinary: boolean, log: (string) => void): ZipDirectoryEntry {
+    dumpToZip(zipDir: ZipDirectoryEntry, lang: Language, puny: boolean, forceMacBinary: boolean, log: (_: string) => void): ZipDirectoryEntry {
         for (const [name, child] of this.items()) {
             const encodedName = encodeFileName(name, lang, puny, log);
             if (child instanceof AbstractFolder) {
@@ -109,7 +109,7 @@ export class AbstractFolder {
     }
 }
 
-function hfs_ts_to_date(hfs_ts) {
+function hfs_ts_to_date(hfs_ts: number) {
     const HFS_UTC_OFFSET = 2082844800;
     if (!hfs_ts) {
         return new Date();
@@ -145,7 +145,7 @@ export class MacFile {
     mddate: number;
     bkdate: number;
 
-    aliastarget: FileOrFolder;
+    aliastarget: FileOrFolder | null;
 
     rsrc: Uint8Array;
     data: Uint8Array;
diff --git a/dumper-companion/src/hfs/main.ts b/dumper-companion/src/hfs/main.ts
index 6e490692..f6055418 100644
--- a/dumper-companion/src/hfs/main.ts
+++ b/dumper-companion/src/hfs/main.ts
@@ -135,6 +135,8 @@ export class Volume extends AbstractFolder {
                 fork = 'rsrc';
             else if (xkrFkType === 0)
                 fork = 'data';
+            else
+                throw new Error("Invalid fork type");
             extoflow[`${xkrFNum},${fork},${xkrFABN}`] = extrec;
         }
 
diff --git a/dumper-companion/src/index.tsx b/dumper-companion/src/index.tsx
index c0c40989..71a10b67 100644
--- a/dumper-companion/src/index.tsx
+++ b/dumper-companion/src/index.tsx
@@ -1,4 +1,4 @@
 import { render } from 'preact';
 import App from './App';
 
-render(<App/>, document.getElementById('app-container'));
+render(<App/>, document.getElementById('app-container') as HTMLElement);
diff --git a/dumper-companion/src/util.ts b/dumper-companion/src/util.ts
index ea213a6a..cc0887d1 100644
--- a/dumper-companion/src/util.ts
+++ b/dumper-companion/src/util.ts
@@ -3,7 +3,7 @@ export function charCode(charStr: string): number {
 }
 
 export function codePoint(charStr: string): number {
-    return charStr.codePointAt(0);
+    return charStr.codePointAt(0) || NaN;
 }
 
 export function byteToHex(byte: number): string {




More information about the Scummvm-git-logs mailing list