taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 29ff9a6966e10cb6e56f77a95ee3ca7e1a833465
parent 69a7fe655abee4fcfa357d0448747c186c84e64e
Author: Florian Dold <florian@dold.me>
Date:   Mon, 27 Jan 2025 15:44:05 +0100

idb-bridge: use shared config, fix compiler errors

Diffstat:
Mpackages/idb-bridge/src/MemoryBackend.ts | 1+
Mpackages/idb-bridge/src/idb-wpt-ported/wptsupport.ts | 30++++++++++++++----------------
Mpackages/idb-bridge/src/tree/b+tree.ts | 8+++++++-
Mpackages/idb-bridge/src/util/enforceRange.ts | 1+
Mpackages/idb-bridge/tsconfig.json | 17+----------------
Mpackages/taler-wallet-core/tsconfig.json | 21+--------------------
Mtsconfig.defaults.json | 2++
7 files changed, 27 insertions(+), 53 deletions(-)

diff --git a/packages/idb-bridge/src/MemoryBackend.ts b/packages/idb-bridge/src/MemoryBackend.ts @@ -210,6 +210,7 @@ function furthestKey( if (!forward && cmpResult === -1) { return key1; } + return undefined; } export interface AccessStats { diff --git a/packages/idb-bridge/src/idb-wpt-ported/wptsupport.ts b/packages/idb-bridge/src/idb-wpt-ported/wptsupport.ts @@ -8,10 +8,10 @@ import { IDBRequest, IDBTransaction, } from "../idbtypes.js"; -import { initTestIndexedDB , useTestIndexedDb } from "../testingdb.js"; +import { useTestIndexedDb } from "../testingdb.js"; import { compareKeys } from "../util/cmp.js"; -export { initTestIndexedDB, useTestIndexedDb } from "../testingdb.js" +export { initTestIndexedDB, useTestIndexedDb } from "../testingdb.js"; export function createdb( t: ExecutionContext<unknown>, @@ -409,20 +409,18 @@ export function format_value(val: any, seen?: any): string { if (val === null) { return "null"; } - - /* falls through */ - default: - try { - return typeof val + ' "' + truncate(String(val), 1000) + '"'; - } catch (e) { - return ( - "[stringifying object threw " + - String(e) + - " with type " + - String(typeof e) + - "]" - ); - } + break; + } + try { + return typeof val + ' "' + truncate(String(val), 1000) + '"'; + } catch (e) { + return ( + "[stringifying object threw " + + String(e) + + " with type " + + String(typeof e) + + "]" + ); } } diff --git a/packages/idb-bridge/src/tree/b+tree.ts b/packages/idb-bridge/src/tree/b+tree.ts @@ -451,7 +451,10 @@ export default class BTree<K = any, V = any> var nu = this.greedyClone(); var del: any; nu.editAll((k, v, i) => { - if (!callback(k, v, i)) return (del = Delete); + if (!callback(k, v, i)) { + return (del = Delete); + } + return undefined; }); if (!del && returnThisIfUnchanged) return this; return nu; @@ -549,6 +552,7 @@ export default class BTree<K = any, V = any> return { done: false, value: reusedArray as [K, V] }; } state = 2; + continue; case 2: // Advance to the next leaf node for (var level = -1; ; ) { @@ -621,6 +625,7 @@ export default class BTree<K = any, V = any> return { done: false, value: reusedArray as [K, V] }; } state = 2; + continue jump; case 2: // Advance to the next leaf node for (var level = -1; ; ) { @@ -833,6 +838,7 @@ export default class BTree<K = any, V = any> _compare, onlyOther, ); + return undefined; } /////////////////////////////////////////////////////////////////////////// diff --git a/packages/idb-bridge/src/util/enforceRange.ts b/packages/idb-bridge/src/util/enforceRange.ts @@ -30,4 +30,5 @@ export const enforceRange = ( if (num >= 0) { return Math.floor(num); } + throw new Error("not reached"); }; diff --git a/packages/idb-bridge/tsconfig.json b/packages/idb-bridge/tsconfig.json @@ -1,24 +1,9 @@ { + "extends": "../../tsconfig.defaults.json", "compilerOptions": { - "composite": true, "lib": ["ES2020"], - "module": "Node16", - "moduleResolution": "Node16", - "target": "ES2020", - "allowJs": true, - "noImplicitAny": true, "outDir": "lib", - "declaration": true, - "declarationMap": true, - "noEmitOnError": true, - "strict": true, - "incremental": true, - "sourceMap": true, "rootDir": "./src", - "esModuleInterop": true, - "importHelpers": true, - "isolatedModules": true, - "typeRoots": ["./node_modules/@types"] }, "include": ["src/**/*"] } diff --git a/packages/taler-wallet-core/tsconfig.json b/packages/taler-wallet-core/tsconfig.json @@ -1,29 +1,10 @@ { - "compileOnSave": true, + "extends": "../../tsconfig.defaults.json", "compilerOptions": { - "composite": true, - "declaration": true, - "declarationMap": false, - "target": "ES2020", - "module": "Node16", - "moduleResolution": "Node16", - "resolveJsonModule": true, - "sourceMap": true, "lib": ["ES2020"], - "resolvePackageJsonImports": true, "types": ["node"], - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "strict": true, - "strictPropertyInitialization": true, "outDir": "lib", - "noImplicitAny": true, - "noImplicitThis": true, - "incremental": true, - "esModuleInterop": true, - "importHelpers": true, "rootDir": "./src", - "typeRoots": ["./node_modules/@types"] }, "references": [ { diff --git a/tsconfig.defaults.json b/tsconfig.defaults.json @@ -18,6 +18,8 @@ "noImplicitAny": true, "noImplicitThis": true, // Settings for module resolution and emit + "resolveJsonModule": true, + "resolvePackageJsonImports": true, "importHelpers": true, "target": "ES2020", "module": "Node16",