Skip to content

Commit dd82b4c

Browse files
committed
build: enable noImplicitReturns compiler option
Turns on the `noImplicitReturns` compiler option and fixes any errors that show up as a result. Fixes #16669.
1 parent 3ec531b commit dd82b4c

File tree

18 files changed

+27
-14
lines changed

18 files changed

+27
-14
lines changed

src/bazel-tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"noUnusedParameters": false,
1313
"noUnusedLocals": false,
1414
"strictNullChecks": true,
15+
"noImplicitReturns": true,
1516
"strictFunctionTypes": true,
1617
"noFallthroughCasesInSwitch": true,
1718
"noImplicitAny": true,

src/cdk/overlay/position/flexible-connected-position-strategy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
574574

575575
return verticalFit && horizontalFit;
576576
}
577+
return false;
577578
}
578579

579580
/**

src/cdk/schematics/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"outDir": "../../../dist/packages/cdk/schematics",
99
"noEmitOnError": false,
1010
"strictNullChecks": true,
11+
"noImplicitReturns": true,
1112
"skipDefaultLibCheck": true,
1213
"skipLibCheck": true,
1314
"sourceMap": true,

src/cdk/tree/nested-node.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,8 @@ export class CdkNestedTreeNode<T> extends CdkTreeNode<T> implements AfterContent
126126
private _getNodeOutlet() {
127127
const outlets = this.nodeOutlet;
128128

129-
if (outlets) {
130-
// Note that since we use `descendants: true` on the query, we have to ensure
131-
// that we don't pick up the outlet of a child node by accident.
132-
return outlets.find(outlet => !outlet._node || outlet._node === this);
133-
}
129+
// Note that since we use `descendants: true` on the query, we have to ensure
130+
// that we don't pick up the outlet of a child node by accident.
131+
return outlets && outlets.find(outlet => !outlet._node || outlet._node === this);
134132
}
135133
}

src/dev-app/tsconfig-aot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"noUnusedParameters": false,
1010
"noUnusedLocals": false,
1111
"strictNullChecks": true,
12+
"noImplicitReturns": true,
1213
"strictFunctionTypes": true,
1314
"noImplicitAny": true,
1415
"noImplicitThis": true,

src/dev-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"noUnusedParameters": false,
1111
"noUnusedLocals": false,
1212
"strictNullChecks": true,
13+
"noImplicitReturns": true,
1314
"strictFunctionTypes": true,
1415
"noImplicitThis": true,
1516
"lib": ["es6", "es2015", "dom"],

src/material-examples/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"noUnusedParameters": false,
1111
"noUnusedLocals": false,
1212
"strictNullChecks": true,
13+
"noImplicitReturns": true,
1314
"strictFunctionTypes": true,
1415
"noImplicitAny": true,
1516
"noImplicitThis": true,

src/material-moment-adapter/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"noUnusedParameters": false,
1111
"noUnusedLocals": false,
1212
"strictNullChecks": true,
13+
"noImplicitReturns": true,
1314
"strictFunctionTypes": true,
1415
"noImplicitAny": true,
1516
"noImplicitThis": true,

src/material/progress-bar/progress-bar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements CanColor
188188
const scale = this.bufferValue / 100;
189189
return {transform: `scaleX(${scale})`};
190190
}
191+
return undefined;
191192
}
192193

193194
ngAfterViewInit() {

src/material/schematics/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"outDir": "../../../dist/packages/material/schematics",
77
"noEmitOnError": false,
88
"strictNullChecks": true,
9+
"noImplicitReturns": true,
910
"skipDefaultLibCheck": true,
1011
"noUnusedLocals": false,
1112
"noUnusedParameters": false,

src/universal-app/tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"noUnusedParameters": false,
99
"noUnusedLocals": false,
1010
"strictNullChecks": true,
11+
"noImplicitReturns": true,
1112
"strictFunctionTypes": true,
1213
"noImplicitAny": true,
1314
"noImplicitThis": true,

src/universal-app/tsconfig-prerender.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"noUnusedParameters": false,
88
"noUnusedLocals": false,
99
"strictNullChecks": true,
10+
"noImplicitReturns": true,
1011
"strictFunctionTypes": true,
1112
"noImplicitAny": true,
1213
"noImplicitThis": true,

tools/dgeni/common/decorators.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@ export function isPrimaryModuleDoc(doc: any) {
4949
}
5050

5151
export function getDirectiveSelectors(classDoc: CategorizedClassDoc) {
52-
if (!classDoc.directiveMetadata) {
53-
return;
54-
}
55-
56-
const directiveSelectors: string = classDoc.directiveMetadata.get('selector');
52+
if (classDoc.directiveMetadata) {
53+
const directiveSelectors: string = classDoc.directiveMetadata.get('selector');
5754

58-
if (directiveSelectors) {
59-
return directiveSelectors.replace(/[\r\n]/g, '').split(/\s*,\s*/).filter(s => s !== '');
55+
if (directiveSelectors) {
56+
return directiveSelectors.replace(/[\r\n]/g, '').split(/\s*,\s*/).filter(s => s !== '');
57+
}
6058
}
59+
return undefined;
6160
}
6261

6362
export function hasMemberDecorator(doc: MemberDoc, decoratorName: string) {

tools/dgeni/common/property-bindings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ function getBindingPropertyData(doc: PropertyMemberDoc, metadata: Map<string, an
5050
alias: doc.decorators!.find(d => d.name == decoratorName)!.arguments![0]
5151
};
5252
}
53+
54+
return undefined;
5355
}

tools/dgeni/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"lib": ["es2015", "dom", "es2016.array.include"],
66
"moduleResolution": "node",
77
"strictNullChecks": true,
8+
"noImplicitReturns": true,
89
"strictFunctionTypes": true,
910
"noImplicitThis": true,
1011
"noImplicitAny": true,

tools/gulp/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"moduleResolution": "node",
99
"outDir": "../../dist/tools/gulp",
1010
"strictNullChecks": true,
11+
"noImplicitReturns": true,
1112
"strictFunctionTypes": true,
1213
"noImplicitThis": true,
1314
"noEmitOnError": true,

tools/package-tools/build-bundles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ export class PackageBundler {
117117
context: 'this',
118118
external: Object.keys(rollupGlobals),
119119
input: config.entry,
120-
onwarn: (warning: any) => {
120+
onwarn: (warning: {message: string, code: string}) => {
121121
// TODO(jelbourn): figure out *why* rollup warns about certain symbols not being found
122122
// when those symbols don't appear to be in the input file in the first place.
123123
if (/but never used/.test(warning.message)) {
124-
return false;
124+
return;
125125
}
126126

127127
if (warning.code === 'CIRCULAR_DEPENDENCY') {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"noFallthroughCasesInSwitch": true,
1111
"noUnusedLocals": false,
1212
"strictNullChecks": true,
13+
"noImplicitReturns": true,
1314
"strictFunctionTypes": true,
1415
"noImplicitAny": true,
1516
"noImplicitThis": true,

0 commit comments

Comments
 (0)