Skip to content

Commit 0b7f5d3

Browse files
clydinalan-agius4
authored andcommittedJun 14, 2022
build: enable TypeScript useUnknownInCatchVariables compiler option
Enables the TypeScript `useUnknownInCatchVariables` option. This option provides additional code safety by ensuring that the catch clause variable is the proper type before attempting to access its properties.
1 parent 4c3a956 commit 0b7f5d3

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed
 

‎packages/angular_devkit/benchmark/src/main.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,7 @@ export async function main({
221221
return 1;
222222
}
223223
} catch (error) {
224-
if (error.message) {
225-
logger.fatal(error.message);
226-
} else {
227-
logger.fatal(error);
228-
}
224+
logger.fatal(error instanceof Error ? error.message : `${error}`);
229225

230226
return 1;
231227
}

‎tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"noImplicitOverride": true,
1111
"noUnusedParameters": false,
1212
"noUnusedLocals": false,
13-
"useUnknownInCatchVariables": false,
1413
"outDir": "./dist",
1514
"rootDir": ".",
1615
"skipLibCheck": true,

0 commit comments

Comments
 (0)
Please sign in to comment.