gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-typescript-core] branch master updated: use shared config, fix co


From: gnunet
Subject: [taler-typescript-core] branch master updated: use shared config, fix compiler warnings
Date: Mon, 27 Jan 2025 16:30:28 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository taler-typescript-core.

The following commit(s) were added to refs/heads/master by this push:
     new 9d6d52e4a use shared config, fix compiler warnings
9d6d52e4a is described below

commit 9d6d52e4adeb9375bacc2305f749c08d1fe12b25
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 27 16:30:14 2025 +0100

    use shared config, fix compiler warnings
---
 packages/aml-backoffice-ui/tsconfig.json           | 33 +---------------------
 packages/anastasis-core/tsconfig.json              | 19 ++-----------
 .../src/components/picker/DatePicker.tsx           |  8 ++++--
 .../src/pages/home/AddingProviderScreen/state.ts   |  2 +-
 .../src/pages/home/EditPoliciesScreen.tsx          |  2 +-
 .../src/pages/home/authMethod/index.tsx            |  2 +-
 packages/anastasis-webui/tsconfig.json             | 31 +-------------------
 packages/bank-ui/src/hooks/account.ts              | 20 +++++++++++--
 packages/bank-ui/src/pages/OperationState/state.ts | 17 +++++++----
 .../bank-ui/src/pages/PaytoWireTransferForm.tsx    |  2 +-
 .../src/pages/account/ShowAccountDetails.tsx       |  4 ++-
 packages/bank-ui/tsconfig.json                     | 33 +---------------------
 12 files changed, 47 insertions(+), 126 deletions(-)

diff --git a/packages/aml-backoffice-ui/tsconfig.json 
b/packages/aml-backoffice-ui/tsconfig.json
index a69021452..3fefe10f0 100644
--- a/packages/aml-backoffice-ui/tsconfig.json
+++ b/packages/aml-backoffice-ui/tsconfig.json
@@ -1,8 +1,6 @@
 {
+  "extends": "../../tsconfig.defaults.json",
   "compilerOptions": {
-    /* Basic Options */
-    "target": "ES2020",
-    "module": "Node16",
     "lib": ["DOM", "ES2020"],
     "allowJs": true /* Allow javascript files to be compiled. */,
     // "checkJs": true,                       /* Report errors in .js files. */
@@ -11,36 +9,7 @@
     "jsxFragmentFactory": "Fragment",
     "resolveJsonModule": true,
     "noEmit": true /* Do not emit outputs. */,
-    // "importHelpers": true,                 /* Import emit helpers from 
'tslib'. */
-    // "downlevelIteration": true,            /* Provide full support for 
iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. 
*/
-    // "isolatedModules": true,               /* Transpile each file as a 
separate module (similar to 'ts.transpileModule'). */
-    /* Strict Type-Checking Options */
-    "strict": true /* Enable all strict type-checking options. */,
-    "noImplicitAny": true /* Raise error on expressions and declarations with 
an implied 'any' type. */,
-    /* Additional Checks */
-    // "noUnusedLocals": true,                /* Report errors on unused 
locals. */
-    // "noUnusedParameters": true,            /* Report errors on unused 
parameters. */
-    // "noImplicitReturns": true,             /* Report error when not all 
code paths in function return a value. */
-    // "noFallthroughCasesInSwitch": true,    /* Report errors for fallthrough 
cases in switch statement. */
-    /* Module Resolution Options */
-    "moduleResolution": "Node16" /* Specify module resolution strategy: 'node' 
(Node.js) or 'classic' (TypeScript pre-1.6). */,
-    "esModuleInterop": true /* */,
-    // "baseUrl": "./",                       /* Base directory to resolve 
non-absolute module names. */
-    // "paths": {},                           /* A series of entries which 
re-map imports to lookup locations relative to the 'baseUrl'. */
-    // "rootDirs": [],                        /* List of root folders whose 
combined content represents the structure of the project at runtime. */
-    // "typeRoots": [],                       /* List of folders to include 
type definitions from. */
-    // "types": [],                           /* Type declaration files to be 
included in compilation. */
     "allowSyntheticDefaultImports": true /* Allow default imports from modules 
with no default export. This does not affect code emit, just typechecking. */,
-    // "preserveSymlinks": true,              /* Do not resolve the real path 
of symlinks. */
-    /* Source Map Options */
-    // "sourceRoot": "./",                    /* Specify the location where 
debugger should locate TypeScript files instead of source locations. */
-    // "mapRoot": "./",                       /* Specify the location where 
debugger should locate map files instead of generated locations. */
-    // "inlineSourceMap": true,               /* Emit a single file with 
source maps instead of having a separate file. */
-    // "inlineSources": true,                 /* Emit the source alongside the 
sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' 
to be set. */
-    /* Experimental Options */
-    // "experimentalDecorators": true,        /* Enables experimental support 
for ES7 decorators. */
-    // "emitDecoratorMetadata": true,         /* Enables experimental support 
for emitting type metadata for decorators. */
-    /* Advanced Options */
     "skipLibCheck": true /* Skip type checking of declaration files. */
   },
   "include": ["src/**/*"]
diff --git a/packages/anastasis-core/tsconfig.json 
b/packages/anastasis-core/tsconfig.json
index e463201e7..9d84ce7d6 100644
--- a/packages/anastasis-core/tsconfig.json
+++ b/packages/anastasis-core/tsconfig.json
@@ -1,25 +1,10 @@
 {
-  "compileOnSave": true,
+  "extends": "../../tsconfig.defaults.json",
   "compilerOptions": {
-    "composite": true,
-    "target": "ES2020",
-    "module": "Node16",
-    "moduleResolution": "Node16",
-    "sourceMap": true,
     "lib": ["ES2020", "DOM"],
-    "noImplicitReturns": true,
-    "noFallthroughCasesInSwitch": true,
-    "strict": true,
-    "strictPropertyInitialization": false,
     "outDir": "lib",
-    "noImplicitAny": true,
-    "noImplicitThis": true,
-    "incremental": true,
-    "esModuleInterop": true,
-    "importHelpers": true,
     "rootDir": "src",
-    "baseUrl": "./src",
-    "typeRoots": ["./node_modules/@types"]
+    "baseUrl": "./src"
   },
   "include": ["src/**/*"],
   "references": [
diff --git a/packages/anastasis-webui/src/components/picker/DatePicker.tsx 
b/packages/anastasis-webui/src/components/picker/DatePicker.tsx
index 7b0bf488d..cf25dc4e8 100644
--- a/packages/anastasis-webui/src/components/picker/DatePicker.tsx
+++ b/packages/anastasis-webui/src/components/picker/DatePicker.tsx
@@ -19,7 +19,7 @@
  * @author Sebastian Javier Marchano (sebasjm)
  */
 
-import { h, Component } from "preact";
+import { Component, h } from "preact";
 
 interface Props {
   closeFunction?: () => void;
@@ -80,7 +80,7 @@ export class DatePicker extends Component<Props, State> {
    * Gets fired when a day gets clicked.
    * @param {object} e The event thrown by the <span /> element clicked
    */
-  dayClicked(e: any) {
+  dayClicked(e: any): false | undefined {
     const element = e.target; // the actual element clicked
 
     if (element.innerHTML === "") return false; // don't continue if <span /> 
empty
@@ -91,6 +91,7 @@ export class DatePicker extends Component<Props, State> {
     // update the state
     this.setState({ currentDate: date });
     this.passDateToParent(date);
+    return undefined;
   }
 
   /**
@@ -162,7 +163,7 @@ export class DatePicker extends Component<Props, State> {
   /**
    * Display the selected month (gets fired when clicking on the date string)
    */
-  displaySelectedMonth() {
+  displaySelectedMonth(): false | undefined {
     if (this.state.selectYearMode) {
       this.toggleYearSelector();
     } else {
@@ -172,6 +173,7 @@ export class DatePicker extends Component<Props, State> {
         displayedYear: this.state.currentDate.getFullYear(),
       });
     }
+    return undefined;
   }
 
   toggleYearSelector() {
diff --git 
a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts 
b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts
index 30e4d750d..3f1dc85c8 100644
--- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts
+++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/state.ts
@@ -19,7 +19,7 @@ import { useAnastasisContext } from 
"../../../context/anastasis.js";
 import { authMethods, KnownAuthMethods } from "../authMethod/index.jsx";
 import { AuthProvByStatusMap, State, testProvider } from "./index.js";
 
-interface Props {
+export interface Props {
   providerType?: KnownAuthMethods;
   onCancel: () => Promise<void>;
   notifications?: Notification[];
diff --git a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx 
b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
index 24550f89e..7b085f994 100644
--- a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx
@@ -29,7 +29,7 @@ export type ProviderInfoByType = {
   [type in KnownAuthMethods]?: ProviderInfo[];
 };
 
-interface Props {
+export interface Props {
   index: number;
   cancel: () => void;
   confirm: (changes: MethodProvider[]) => void;
diff --git a/packages/anastasis-webui/src/pages/home/authMethod/index.tsx 
b/packages/anastasis-webui/src/pages/home/authMethod/index.tsx
index 9f7f4a197..aeb644355 100644
--- a/packages/anastasis-webui/src/pages/home/authMethod/index.tsx
+++ b/packages/anastasis-webui/src/pages/home/authMethod/index.tsx
@@ -44,7 +44,7 @@ export interface AuthMethodSolveProps {
   id: string;
 }
 
-interface AuthMethodConfiguration {
+export interface AuthMethodConfiguration {
   icon: VNode;
   label: string;
   setup: (props: AuthMethodSetupProps) => VNode;
diff --git a/packages/anastasis-webui/tsconfig.json 
b/packages/anastasis-webui/tsconfig.json
index 9e52f2b7e..1cfada949 100644
--- a/packages/anastasis-webui/tsconfig.json
+++ b/packages/anastasis-webui/tsconfig.json
@@ -1,8 +1,7 @@
 {
+  "extends": "../../tsconfig.defaults.json",
   "compilerOptions": {
     /* Basic Options */
-    "target": "ES2020",
-    "module": "Node16",
     "lib": [
       "DOM",
       "ES2020"
@@ -13,36 +12,8 @@
     "jsxFactory": "h",
     "jsxFragmentFactory": "Fragment",
     "noEmit": true /* Do not emit outputs. */,
-    // "importHelpers": true,                 /* Import emit helpers from 
'tslib'. */
-    // "downlevelIteration": true,            /* Provide full support for 
iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. 
*/
-    // "isolatedModules": true,               /* Transpile each file as a 
separate module (similar to 'ts.transpileModule'). */
-    /* Strict Type-Checking Options */
-    "strict": true /* Enable all strict type-checking options. */,
-    "noImplicitAny": true /* Raise error on expressions and declarations with 
an implied 'any' type. */,
-    /* Additional Checks */
-    // "noUnusedLocals": true,                /* Report errors on unused 
locals. */
-    // "noUnusedParameters": true,            /* Report errors on unused 
parameters. */
-    // "noImplicitReturns": true,             /* Report error when not all 
code paths in function return a value. */
-    // "noFallthroughCasesInSwitch": true,    /* Report errors for fallthrough 
cases in switch statement. */
     /* Module Resolution Options */
-    "moduleResolution": "Node16" /* Specify module resolution strategy: 'node' 
(Node.js) or 'classic' (TypeScript pre-1.6). */,
-    "esModuleInterop": true /* */,
-    // "baseUrl": "./",                       /* Base directory to resolve 
non-absolute module names. */
-    // "paths": {},                           /* A series of entries which 
re-map imports to lookup locations relative to the 'baseUrl'. */
-    // "rootDirs": [],                        /* List of root folders whose 
combined content represents the structure of the project at runtime. */
-    // "typeRoots": [],                       /* List of folders to include 
type definitions from. */
-    // "types": [],                           /* Type declaration files to be 
included in compilation. */
     "allowSyntheticDefaultImports": true /* Allow default imports from modules 
with no default export. This does not affect code emit, just typechecking. */,
-    // "preserveSymlinks": true,              /* Do not resolve the real path 
of symlinks. */
-    /* Source Map Options */
-    // "sourceRoot": "./",                    /* Specify the location where 
debugger should locate TypeScript files instead of source locations. */
-    // "mapRoot": "./",                       /* Specify the location where 
debugger should locate map files instead of generated locations. */
-    // "inlineSourceMap": true,               /* Emit a single file with 
source maps instead of having a separate file. */
-    // "inlineSources": true,                 /* Emit the source alongside the 
sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' 
to be set. */
-    /* Experimental Options */
-    // "experimentalDecorators": true,        /* Enables experimental support 
for ES7 decorators. */
-    // "emitDecoratorMetadata": true,         /* Enables experimental support 
for emitting type metadata for decorators. */
-    /* Advanced Options */
     "skipLibCheck": true /* Skip type checking of declaration files. */
   },
   "include": [
diff --git a/packages/bank-ui/src/hooks/account.ts 
b/packages/bank-ui/src/hooks/account.ts
index a018db4bb..c64e4229f 100644
--- a/packages/bank-ui/src/hooks/account.ts
+++ b/packages/bank-ui/src/hooks/account.ts
@@ -16,8 +16,12 @@
 
 import {
   AccessToken,
+  HttpStatusCode,
+  OperationFail,
   OperationOk,
+  TalerCorebankApi,
   TalerCoreBankResultByMethod,
+  TalerError,
   TalerHttpError,
   WithdrawalOperationStatusFlag,
 } from "@gnu-taler/taler-util";
@@ -26,7 +30,7 @@ import { useSessionState } from "./session.js";
 
 // FIX default import https://github.com/microsoft/TypeScript/issues/49189
 import { useBankCoreApiContext } from "@gnu-taler/web-util/browser";
-import _useSWR, { SWRHook, mutate } from "swr";
+import _useSWR, { mutate, SWRHook } from "swr";
 import { PAGINATED_LIST_REQUEST } from "../utils.js";
 const useSWR = _useSWR as unknown as SWRHook;
 
@@ -300,7 +304,19 @@ export function revalidateTransactions() {
     { revalidate: true },
   );
 }
-export function useTransactions(account: string, initial?: number) {
+
+export function useTransactions(
+  account: string,
+  initial?: number,
+):
+  | TalerError<{
+      requestUrl: string;
+      requestMethod: string;
+    }>
+  | OperationFail<HttpStatusCode.NotFound>
+  | OperationFail<HttpStatusCode.Unauthorized>
+  | PaginatedResult<TalerCorebankApi.BankAccountTransactionInfo[]>
+  | undefined {
   const { state: credentials } = useSessionState();
   const token =
     credentials.status !== "loggedIn" ? undefined : credentials.token;
diff --git a/packages/bank-ui/src/pages/OperationState/state.ts 
b/packages/bank-ui/src/pages/OperationState/state.ts
index c152e55dd..9165160f0 100644
--- a/packages/bank-ui/src/pages/OperationState/state.ts
+++ b/packages/bank-ui/src/pages/OperationState/state.ts
@@ -17,6 +17,7 @@
 import {
   Amounts,
   HttpStatusCode,
+  OperationFail,
   TalerCoreBankErrorsByMethod,
   TalerCorebankApi,
   TalerError,
@@ -25,16 +26,15 @@ import {
   parseWithdrawUri,
   stringifyWithdrawUri,
 } from "@gnu-taler/taler-util";
-import { utils } from "@gnu-taler/web-util/browser";
+import { useBankCoreApiContext, utils } from "@gnu-taler/web-util/browser";
 import { useEffect, useState } from "preact/hooks";
 import { mutate } from "swr";
-import { useBankCoreApiContext } from "@gnu-taler/web-util/browser";
+import { useSettingsContext } from "../../context/settings.js";
 import { useWithdrawalDetails } from "../../hooks/account.js";
-import { useSessionState } from "../../hooks/session.js";
 import { useBankState } from "../../hooks/bank-state.js";
 import { usePreferences } from "../../hooks/preferences.js";
+import { useSessionState } from "../../hooks/session.js";
 import { Props, State } from "./index.js";
-import { useSettingsContext } from "../../context/settings.js";
 
 export function useComponentState({
   currency,
@@ -102,7 +102,12 @@ export function useComponentState({
 
   const wid = withdrawalOperationId;
 
-  async function doAbort() {
+  async function doAbort(): Promise<
+    | OperationFail<HttpStatusCode.NotFound>
+    | OperationFail<HttpStatusCode.Conflict>
+    | OperationFail<HttpStatusCode.BadRequest>
+    | undefined
+  > {
     if (!creds) return;
     const resp = await bank.abortWithdrawalById(creds, wid);
     if (resp.type === "ok") {
@@ -111,6 +116,7 @@ export function useComponentState({
     } else {
       return resp;
     }
+    return undefined;
   }
 
   async function doConfirm(): Promise<
@@ -123,6 +129,7 @@ export function useComponentState({
     } else {
       return resp;
     }
+    return undefined;
   }
 
   const uri = stringifyWithdrawUri({
diff --git a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx 
b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx
index c36e9a921..d1f4e70bc 100644
--- a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx
+++ b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx
@@ -51,7 +51,7 @@ import { undefinedIfEmpty, validateIBAN, validateTalerBank } 
from "../utils.js";
 
 const TALER_SCREEN_ID = 106;
 
-interface Props {
+export interface Props {
   focus?: boolean;
   withAccount?: string;
   withSubject?: string;
diff --git a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx 
b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx
index c3aa7d0ac..3f9212268 100644
--- a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx
+++ b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx
@@ -40,11 +40,11 @@ import { useState } from "preact/hooks";
 import { ErrorLoadingWithDebug } from 
"../../components/ErrorLoadingWithDebug.js";
 import { useAccountDetails } from "../../hooks/account.js";
 import { useBankState } from "../../hooks/bank-state.js";
+import { usePreferences } from "../../hooks/preferences.js";
 import { useSessionState } from "../../hooks/session.js";
 import { LoginForm } from "../LoginForm.js";
 import { ProfileNavigation } from "../ProfileNavigation.js";
 import { AccountForm } from "../admin/AccountForm.js";
-import { usePreferences } from "../../hooks/preferences.js";
 
 const TALER_SCREEN_ID = 118;
 
@@ -499,6 +499,8 @@ export function ShowAccountDetails({
                         </div>
                       );
                     }
+                    default:
+                      return `unsupported account type ${payto.targetType}`;
                   }
                 })(payto)}
 
diff --git a/packages/bank-ui/tsconfig.json b/packages/bank-ui/tsconfig.json
index 9826fac07..3d569fd04 100644
--- a/packages/bank-ui/tsconfig.json
+++ b/packages/bank-ui/tsconfig.json
@@ -1,45 +1,14 @@
 {
+  "extends": "../../tsconfig.defaults.json",
   "compilerOptions": {
-    /* Basic Options */
-    "target": "ES2020",
-    "module": "Node16",
     "lib": ["DOM", "ES2020"],
-    "allowJs": true /* Allow javascript files to be compiled. */,
-    // "checkJs": true,                       /* Report errors in .js files. */
     "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', 
or 'react'. */,
     "jsxFactory": "h",
     "jsxFragmentFactory": "Fragment",
     "noEmit": true /* Do not emit outputs. */,
-    // "importHelpers": true,                 /* Import emit helpers from 
'tslib'. */
-    // "downlevelIteration": true,            /* Provide full support for 
iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. 
*/
-    // "isolatedModules": true,               /* Transpile each file as a 
separate module (similar to 'ts.transpileModule'). */
-    /* Strict Type-Checking Options */
-    "strict": true /* Enable all strict type-checking options. */,
-    "noImplicitAny": true /* Raise error on expressions and declarations with 
an implied 'any' type. */,
-    /* Additional Checks */
-    // "noUnusedLocals": true,                /* Report errors on unused 
locals. */
-    // "noUnusedParameters": true,            /* Report errors on unused 
parameters. */
-    // "noImplicitReturns": true,             /* Report error when not all 
code paths in function return a value. */
-    // "noFallthroughCasesInSwitch": true,    /* Report errors for fallthrough 
cases in switch statement. */
     /* Module Resolution Options */
-    "moduleResolution": "Node16" /* Specify module resolution strategy: 'node' 
(Node.js) or 'classic' (TypeScript pre-1.6). */,
     "esModuleInterop": true /* */,
-    // "baseUrl": "./",                       /* Base directory to resolve 
non-absolute module names. */
-    // "paths": {},                           /* A series of entries which 
re-map imports to lookup locations relative to the 'baseUrl'. */
-    // "rootDirs": [],                        /* List of root folders whose 
combined content represents the structure of the project at runtime. */
-    // "typeRoots": [],                       /* List of folders to include 
type definitions from. */
-    // "types": [],                           /* Type declaration files to be 
included in compilation. */
     "allowSyntheticDefaultImports": true /* Allow default imports from modules 
with no default export. This does not affect code emit, just typechecking. */,
-    // "preserveSymlinks": true,              /* Do not resolve the real path 
of symlinks. */
-    /* Source Map Options */
-    // "sourceRoot": "./",                    /* Specify the location where 
debugger should locate TypeScript files instead of source locations. */
-    // "mapRoot": "./",                       /* Specify the location where 
debugger should locate map files instead of generated locations. */
-    // "inlineSourceMap": true,               /* Emit a single file with 
source maps instead of having a separate file. */
-    // "inlineSources": true,                 /* Emit the source alongside the 
sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' 
to be set. */
-    /* Experimental Options */
-    // "experimentalDecorators": true,        /* Enables experimental support 
for ES7 decorators. */
-    // "emitDecoratorMetadata": true,         /* Enables experimental support 
for emitting type metadata for decorators. */
-    /* Advanced Options */
     "skipLibCheck": true /* Skip type checking of declaration files. */
   },
   "include": ["src/**/*"]

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]