diff --git a/examples/cactus-example-supply-chain-frontend/tsconfig.json b/examples/cactus-example-supply-chain-frontend/tsconfig.json index cb978460758..57811820969 100644 --- a/examples/cactus-example-supply-chain-frontend/tsconfig.json +++ b/examples/cactus-example-supply-chain-frontend/tsconfig.json @@ -14,7 +14,7 @@ "importHelpers": true, "target": "ES2022", "lib": [ - "es2018", + "ES2022", "dom" ], "resolveJsonModule": true, diff --git a/examples/test-run-transaction/tsconfig.json b/examples/test-run-transaction/tsconfig.json index 98a8691880f..d56cfc0018c 100644 --- a/examples/test-run-transaction/tsconfig.json +++ b/examples/test-run-transaction/tsconfig.json @@ -2,12 +2,10 @@ "compilerOptions": { /* Basic Options */ "incremental": true, /* Enable incremental compilation */ - "target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "target": "ES2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": [ - "es2015", - "es2016", - "es2017", + "ES2022", "dom" ], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts b/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts index bef8326dffb..f6bf6029d1a 100644 --- a/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts +++ b/packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts @@ -2,6 +2,25 @@ import { RuntimeError } from "run-time-error-cjs"; import { coerceUnknownToError } from "./coerce-unknown-to-error"; /** + * ## DEPRECATED + * + * Instead of relying on this function, in the future, use the new `cause` + * property of the built-in `Error` type in combination + * with the `asError(unknown)` utility function: + * ```typescript + * import { asError } from "@hyperledger/cactus-common"; + * + * try { + * await performSomeImportantOperation(); + * } catch (ex: unknown) { + * const cause = asError(ex); + * throw new Error("Something went wrong while doing something.", { cause }); + * } + * ``` + * More information about the EcmaScript proposal that made this possible: + * https://github.com/tc39/proposal-error-cause + * + * ## The Old Documentation Prior to the Deprecation: * ### STANDARD EXCEPTION HANDLING - EXAMPLE WITH RE-THROW: * * Use the this utility function and pass in any throwable of whatever type and format @@ -77,6 +96,7 @@ import { coerceUnknownToError } from "./coerce-unknown-to-error"; * return result; // 42 * } * ``` + * @deprecated * * @param message The contextual information that will be passed into the * constructor of the returned {@link RuntimeError} instance. @@ -93,9 +113,28 @@ export function createRuntimeErrorWithCause( } /** + * ## DEPRECATED + * + * Instead of relying on this function, in the future, use the new `cause` + * property of the built-in `Error` type in combination + * with the `asError(unknown)` utility function: + * ```typescript + * import { asError } from "@hyperledger/cactus-common"; + * + * try { + * await performSomeImportantOperation(); + * } catch (ex: unknown) { + * const cause = asError(ex); + * throw new Error("Something went wrong while doing something.", { cause }); + * } + * ``` + * More information about the EcmaScript proposal that made this possible: + * https://github.com/tc39/proposal-error-cause + * * An alias to the `createRuntimeErrorWithCause` function for those prefering * a shorter utility for their personal style. * + * @deprecated * @see {@link createRuntimeErrorWithCause} * @returns `RuntimeError` */ diff --git a/tsconfig.base.json b/tsconfig.base.json index 1290f6141f9..3867cf14741 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -9,13 +9,10 @@ }, /* Basic Options */ "incremental": true, /* Enable incremental compilation */ - "target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "target": "ES2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": [ - "es2015", - "es2016", - "es2017", - "es2019", + "ES2022", "dom" ], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ diff --git a/tsconfig.json b/tsconfig.json index 600c138e5ed..790f7474e6d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -172,13 +172,10 @@ ], "compilerOptions": { "incremental": true, - "target": "ES2017", + "target": "ES2022", "module": "Node16", "lib": [ - "es2015", - "es2016", - "es2017", - "es2019", + "ES2022", "dom" ] /* Specify library files to be included in the compilation. */, // "allowJs": true, /* Allow javascript files to be compiled. */