build: ensure schematics are built with typescript strict flag (#31967)

Follow-up to #30993 where we build all Angular packages with
the TypeScript `--strict` flag. The flag improves overall code
health and also helps us catch issues easier.

PR Close #31967
This commit is contained in:
Paul Gschwendtner 2019-08-02 16:42:11 +02:00 committed by Kara Erickson
parent b25f925311
commit e4d5102b17
2 changed files with 15 additions and 15 deletions

View File

@ -166,16 +166,18 @@ function filterQueryClassMemberNodes(
// (1) queries used in the "ngOnInit" lifecycle hook are static. // (1) queries used in the "ngOnInit" lifecycle hook are static.
// (2) inputs with setters can access queries statically. // (2) inputs with setters can access queries statically.
return classDecl.members return classDecl.members
.filter(m => { .filter(
if (ts.isMethodDeclaration(m) && m.body && hasPropertyNameText(m.name) && (m):
STATIC_QUERY_LIFECYCLE_HOOKS[query.type].indexOf(m.name.text) !== -1) { m is(ts.SetAccessorDeclaration | ts.MethodDeclaration) => {
return true; if (ts.isMethodDeclaration(m) && m.body && hasPropertyNameText(m.name) &&
} else if ( STATIC_QUERY_LIFECYCLE_HOOKS[query.type].indexOf(m.name.text) !== -1) {
knownInputNames && ts.isSetAccessor(m) && m.body && hasPropertyNameText(m.name) && return true;
knownInputNames.indexOf(m.name.text) !== -1) { } else if (
return true; knownInputNames && ts.isSetAccessor(m) && m.body &&
} hasPropertyNameText(m.name) && knownInputNames.indexOf(m.name.text) !== -1) {
return false; return true;
}) }
.map((member: ts.SetAccessorDeclaration | ts.MethodDeclaration) => member.body !); return false;
})
.map(member => member.body !);
} }

View File

@ -1,10 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"noImplicitReturns": true, "noImplicitReturns": true,
"noImplicitAny": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"strictNullChecks": true, "strict": true,
"strictPropertyInitialization": true,
"lib": ["es2015"], "lib": ["es2015"],
"types": [], "types": [],
"baseUrl": ".", "baseUrl": ".",