Skip to content

Commit

Permalink
build: ensure schematics are built with typescript strict flag
Browse files Browse the repository at this point in the history
Follow-up to angular#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.
  • Loading branch information
devversion committed Aug 2, 2019
1 parent 046532b commit 2758783
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,18 @@ function filterQueryClassMemberNodes(
// (1) queries used in the "ngOnInit" lifecycle hook are static.
// (2) inputs with setters can access queries statically.
return classDecl.members
.filter(m => {
if (ts.isMethodDeclaration(m) && m.body && hasPropertyNameText(m.name) &&
STATIC_QUERY_LIFECYCLE_HOOKS[query.type].indexOf(m.name.text) !== -1) {
return true;
} else if (
knownInputNames && ts.isSetAccessor(m) && m.body && hasPropertyNameText(m.name) &&
knownInputNames.indexOf(m.name.text) !== -1) {
return true;
}
return false;
})
.map((member: ts.SetAccessorDeclaration | ts.MethodDeclaration) => member.body !);
.filter(
(m):
m is(ts.SetAccessorDeclaration | ts.MethodDeclaration) => {
if (ts.isMethodDeclaration(m) && m.body && hasPropertyNameText(m.name) &&
STATIC_QUERY_LIFECYCLE_HOOKS[query.type].indexOf(m.name.text) !== -1) {
return true;
} else if (
knownInputNames && ts.isSetAccessor(m) && m.body &&
hasPropertyNameText(m.name) && knownInputNames.indexOf(m.name.text) !== -1) {
return true;
}
return false;
})
.map(member => member.body !);
}
4 changes: 1 addition & 3 deletions packages/core/schematics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"compilerOptions": {
"noImplicitReturns": true,
"noImplicitAny": true,
"noFallthroughCasesInSwitch": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"strict": true,
"lib": ["es2015"],
"types": [],
"baseUrl": ".",
Expand Down

0 comments on commit 2758783

Please sign in to comment.