refactor: fix remaining typescript strict flag failures (#30993)

Fixes the remaining TypeScript --strict flag failures for source
files which are not part of any specific release package.

PR Close #30993
This commit is contained in:
Paul Gschwendtner 2019-06-14 09:29:04 +02:00 committed by Miško Hevery
parent 012b535147
commit a27c5dd740
5 changed files with 27 additions and 14 deletions

View File

@ -112,7 +112,7 @@ export class ExpandingRowHost implements AfterViewInit,
* function around. This enables us to detach the click listener when * function around. This enables us to detach the click listener when
* component is destroyed. * component is destroyed.
*/ */
private handleRootMouseUpBound: EventListenerObject = this.handleRootMouseUp.bind(this); private handleRootMouseUpBound = this.handleRootMouseUp.bind(this);
/** /**
* 16px is the margin animation we have on cfc-expanding-row component. * 16px is the margin animation we have on cfc-expanding-row component.

View File

@ -63,6 +63,7 @@ function setInterval(fn: Function, delay: number) {
while (rootZone.parent) { while (rootZone.parent) {
rootZone = rootZone.parent; rootZone = rootZone.parent;
} }
rootZone.run( rootZone.run(() => {
() => { window.setInterval(function() { zone.run(fn, this, arguments as any); }, delay); }); window.setInterval(function(this: unknown) { zone.run(fn, this, arguments as any); }, delay);
});
} }

View File

@ -10,6 +10,9 @@ ng_module(
"src/**/*.ts", "src/**/*.ts",
], ],
), ),
# Disable building with strict compatibility as the http package is no longer
# maintained and therefore not needed to be made compatible with --strict.
tsconfig = "//packages:tsconfig-build-no-strict",
deps = [ deps = [
"//packages/core", "//packages/core",
"//packages/platform-browser", "//packages/platform-browser",

View File

@ -10,6 +10,9 @@ ng_module(
"src/**/*.ts", "src/**/*.ts",
], ],
), ),
# Disable building with strict compatibility as the platform-webworker package is
# deprecated and therefore it is not needed to make it compatible with --strict.
tsconfig = "//packages:tsconfig-build-no-strict",
deps = [ deps = [
"//packages:types", "//packages:types",
"//packages/common", "//packages/common",

View File

@ -1,6 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", // Setting the "baseUrl" to a different directory than "packages/" because otherwise
// packages like the native "http" module are resolved to the Angular "http" package.
"baseUrl": "..",
"declaration": true, "declaration": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
@ -12,10 +14,10 @@
"noImplicitAny": true, "noImplicitAny": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"paths": { "paths": {
"selenium-webdriver": ["../node_modules/@types/selenium-webdriver/index.d.ts"], "selenium-webdriver": ["./node_modules/@types/selenium-webdriver/index.d.ts"],
"rxjs/*": ["../node_modules/rxjs/*"], "rxjs/*": ["./node_modules/rxjs/*"],
"@angular/*": ["./*"], "@angular/*": ["./packages/*"],
"e2e_util/*": ["../modules/e2e_util/*"] "e2e_util/*": ["./modules/e2e_util/*"]
}, },
"rootDir": ".", "rootDir": ".",
"inlineSourceMap": true, "inlineSourceMap": true,
@ -34,13 +36,17 @@
"compiler-cli/integrationtest", "compiler-cli/integrationtest",
"core/schematics", "core/schematics",
"elements/schematics", "elements/schematics",
// Do not build the example e2e spec files since those require custom typings and // Do not build the example package because there are no legacy tests that need to be
// aren't required to build all packages. // built. Additionally the examples are not made compatible with the "strict" option.
"examples/**/e2e_test/*", "examples/**",
// Exclude the "main.ts" files for each example group because this file is used by // Http doesn't need to built since it is no longer maintained and
// Bazel to launch the devserver and uses AOT compilation. // will be removed eventually. See: FW-1392.
"examples/**/main.ts", "http/**",
"platform-server/integrationtest", "platform-server/integrationtest",
// The webworker packages have deprecated and are not made compatible with the
// strict flag. Until these packages are removed, we exclude them here.
"platform-webworker/**",
"platform-webworker-dynamic/**",
"router/test/aot_ngsummary_test", "router/test/aot_ngsummary_test",
"zone.js" "zone.js"
] ]