From c7d20639c642aac50c06102164d8fc6581166067 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 7 Jun 2021 17:09:00 +0200 Subject: [PATCH] build: enable noImplicitOverride in project (#42512) Enables the `noImplicitOverride` option to improve overall codehealth in the repository. PR Close #42512 --- .circleci/config.yml | 2 +- dev-infra/tsconfig.json | 4 +++- packages/core/schematics/tsconfig.json | 1 + packages/service-worker/cli/tsconfig.json | 1 + packages/tsconfig-build.json | 1 + packages/tsconfig-legacy-saucelabs.json | 11 +++++++++++ packages/tsconfig.json | 1 + packages/zone.js/tsconfig.json | 1 + 8 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 packages/tsconfig-legacy-saucelabs.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 91e3214cad..97788b2fed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -678,7 +678,7 @@ jobs: background: true # add module umd tsc compile option so the test can work # properly in the legacy browsers - - run: yarn tsc -p packages --module UMD + - run: yarn tsc -p packages/tsconfig-legacy-saucelabs.json --module UMD - run: yarn tsc -p modules --module UMD - run: yarn bazel build //packages/zone.js:npm_package # Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling diff --git a/dev-infra/tsconfig.json b/dev-infra/tsconfig.json index a107894e33..b5c32c096c 100644 --- a/dev-infra/tsconfig.json +++ b/dev-infra/tsconfig.json @@ -1,6 +1,8 @@ { "compilerOptions": { "strict": true, - "downlevelIteration": true + "downlevelIteration": true, + "noImplicitAny": true, + "noImplicitOverride": true } } diff --git a/packages/core/schematics/tsconfig.json b/packages/core/schematics/tsconfig.json index 53930ff133..89cfe2bb70 100644 --- a/packages/core/schematics/tsconfig.json +++ b/packages/core/schematics/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "noImplicitReturns": true, + "noImplicitOverride": true, "noFallthroughCasesInSwitch": true, "strict": true, "moduleResolution": "node", diff --git a/packages/service-worker/cli/tsconfig.json b/packages/service-worker/cli/tsconfig.json index 4b9edf0ef1..f7f78dabdb 100644 --- a/packages/service-worker/cli/tsconfig.json +++ b/packages/service-worker/cli/tsconfig.json @@ -9,6 +9,7 @@ "strictPropertyInitialization": true, "outDir": "../../../dist/all/@angular/service-worker/cli-custom", "noImplicitAny": true, + "noImplicitOverride": true, "noFallthroughCasesInSwitch": true, "rootDir": ".", "paths": { diff --git a/packages/tsconfig-build.json b/packages/tsconfig-build.json index e9793106cc..7bfa7c1761 100644 --- a/packages/tsconfig-build.json +++ b/packages/tsconfig-build.json @@ -8,6 +8,7 @@ "declaration": true, "stripInternal": true, "noImplicitAny": true, + "noImplicitOverride": true, "strictNullChecks": true, "strict": true, "strictPropertyInitialization": true, diff --git a/packages/tsconfig-legacy-saucelabs.json b/packages/tsconfig-legacy-saucelabs.json new file mode 100644 index 0000000000..55a8be3522 --- /dev/null +++ b/packages/tsconfig-legacy-saucelabs.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + // The project uses Bazel for TypeScript compilation. Unlike with Bazel, we build all + // sources as part of a single TypeScript compilation. This results in `@internal` + // declarations not being omitted between the logical as defined per the Bazel targets. + // This can cause issues where the `override` keyword is needed for the legacy TS + // compilation, but not within Bazel where the overridden member has `@internal`. + "noImplicitOverride": false, + } +} diff --git a/packages/tsconfig.json b/packages/tsconfig.json index ae0df22ad6..681addcbb2 100644 --- a/packages/tsconfig.json +++ b/packages/tsconfig.json @@ -14,6 +14,7 @@ "strictPropertyInitialization": true, "outDir": "../dist/all/@angular", "noImplicitAny": true, + "noImplicitOverride": true, "noFallthroughCasesInSwitch": true, "paths": { "selenium-webdriver": ["./node_modules/@types/selenium-webdriver/index.d.ts"], diff --git a/packages/zone.js/tsconfig.json b/packages/zone.js/tsconfig.json index 6ee93c8e1e..abf52609e4 100644 --- a/packages/zone.js/tsconfig.json +++ b/packages/zone.js/tsconfig.json @@ -9,6 +9,7 @@ "noEmitOnError": false, "stripInternal": false, "strict": true, + "noImplicitOverride": true, "lib": [ "es5", "dom",