[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': [,,,,,,,,,,,,,,,'ï¼','ï¼','ï¼','ï¼','ï¼','ï¼','ï¼','ï¼','ï¼','ï¼',,,,,,,,'A','ï¼¢','ï¼£','D','ï¼¥','F','ï¼§','H','I','J','K','L','ï¼','ï¼®','O','ï¼°','ï¼±','ï¼²','ï¼³','ï¼´','ï¼µ','ï¼¶','ï¼·','X','ï¼¹','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