Skip to content

refactor: enable useUnknownInCatchVariables compiler option #24215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bazel-tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"noImplicitReturns": true,
"strictFunctionTypes": true,
"noImplicitOverride": true,
"useUnknownInCatchVariables": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitThis": true,
Expand Down
1 change: 1 addition & 0 deletions src/cdk/schematics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"outDir": "../../../dist/packages/cdk/schematics",
"noEmitOnError": false,
"strictNullChecks": true,
"useUnknownInCatchVariables": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitAny": true,
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/schematics/utils/project-tsconfig-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function getWorkspaceConfigGracefully(
return await readJsonWorkspace(path, {
readFile: async filePath => tree.read(filePath)!.toString(),
} as WorkspaceHost);
} catch (e) {
} catch {
return null;
}
}
14 changes: 7 additions & 7 deletions src/cdk/testing/tests/cross-environment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function crossEnvironmentSpecs(
await loader.getChildLoader('error');
fail('Expected to throw');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(HarnessLoader for element matching selector: "error")',
);
Expand All @@ -82,7 +82,7 @@ export function crossEnvironmentSpecs(
await countersLoader.getHarness(SubComponentHarness);
fail('Expected to throw');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(SubComponentHarness with host element matching selector: "test-sub")',
);
Expand Down Expand Up @@ -112,7 +112,7 @@ export function crossEnvironmentSpecs(
await harness.errorItem();
fail('Expected to throw');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(TestElement for element matching selector: "wrong locator")',
);
Expand Down Expand Up @@ -147,7 +147,7 @@ export function crossEnvironmentSpecs(
await harness.errorSubComponent();
fail('Expected to throw');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(WrongComponentHarness with host element matching selector: "wrong-selector")',
);
Expand Down Expand Up @@ -211,7 +211,7 @@ export function crossEnvironmentSpecs(
await harness.requiredAncestorRestrictedMissingSubcomponent();
fail('Expected to throw');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(SubComponentHarness with host element matching selector: "test-sub"' +
' satisfying the constraints: has ancestor matching selector ".not-found")',
Expand Down Expand Up @@ -311,7 +311,7 @@ export function crossEnvironmentSpecs(
await harness.requiredFourIteamToolsLists();
fail('Expected to throw');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(SubComponentHarness with host element matching selector: "test-sub" satisfying' +
' the constraints: title = "List of test tools", item count = 4)',
Expand Down Expand Up @@ -640,7 +640,7 @@ export function crossEnvironmentSpecs(
await harness.missingElementsAndHarnesses();
fail('Expected to throw.');
} catch (e) {
expect(e.message).toBe(
expect((e as Error).message).toBe(
'Failed to find element matching one of the following queries:' +
'\n(TestElement for element matching selector: ".not-found"),' +
'\n(SubComponentHarness with host element matching selector: "test-sub" satisfying' +
Expand Down
1 change: 1 addition & 0 deletions src/material/schematics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"outDir": "../../../dist/packages/material/schematics",
"noEmitOnError": false,
"strictNullChecks": true,
"useUnknownInCatchVariables": true,
"noImplicitOverride": true,
"noImplicitAny": true,
"noFallthroughCasesInSwitch": true,
Expand Down
1 change: 1 addition & 0 deletions tools/dgeni/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"moduleResolution": "node",
"esModuleInterop": true,
"strictNullChecks": true,
"useUnknownInCatchVariables": true,
"noImplicitReturns": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": false,
"strictNullChecks": true,
"useUnknownInCatchVariables": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"strictFunctionTypes": true,
Expand Down