Skip to content

Commit 4489199

Browse files
committed
fix(build): add missing return types now enforced by linter
1 parent bc585f2 commit 4489199

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+469
-402
lines changed

modules/angular2/src/change_detection/change_detection_jit_generator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ export class ChangeDetectorJITGenerator {
138138
.map((d) => this._genGetDetector(d.directiveIndex));
139139
}
140140

141-
_genGetDirective(d: DirectiveIndex) { return `this.directive_${d.name}`; }
141+
_genGetDirective(d: DirectiveIndex): string { return `this.directive_${d.name}`; }
142142

143-
_genGetDetector(d: DirectiveIndex) { return `this.detector_${d.name}`; }
143+
_genGetDetector(d: DirectiveIndex): string { return `this.detector_${d.name}`; }
144144

145145
_getNonNullPipeNames(): List<string> {
146146
var pipes = [];
@@ -152,7 +152,7 @@ export class ChangeDetectorJITGenerator {
152152
return pipes;
153153
}
154154

155-
_genFieldDefinitions() {
155+
_genFieldDefinitions(): string {
156156
var fields = [];
157157
fields = fields.concat(this._fieldNames);
158158
fields = fields.concat(this._getNonNullPipeNames());
@@ -226,7 +226,7 @@ export class ChangeDetectorJITGenerator {
226226
return `${rec}${this._maybeGenLastInDirective(r)}`;
227227
}
228228

229-
_genDirectiveLifecycle(r: ProtoRecord) {
229+
_genDirectiveLifecycle(r: ProtoRecord): string {
230230
if (r.name === "onCheck") {
231231
return this._genOnCheck(r);
232232
} else if (r.name === "onInit") {

modules/angular2/src/change_detection/change_detection_util.ts

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var _simpleChanges = [
3535
new SimpleChange(null, null)
3636
];
3737

38-
function _simpleChange(previousValue, currentValue) {
38+
function _simpleChange(previousValue, currentValue): SimpleChange {
3939
var index = _simpleChangesIndex++ % 20;
4040
var s = _simpleChanges[index];
4141
s.previousValue = previousValue;
@@ -44,41 +44,43 @@ function _simpleChange(previousValue, currentValue) {
4444
}
4545

4646
export class ChangeDetectionUtil {
47-
static uninitialized() { return uninitialized; }
48-
49-
static arrayFn0() { return []; }
50-
static arrayFn1(a1) { return [a1]; }
51-
static arrayFn2(a1, a2) { return [a1, a2]; }
52-
static arrayFn3(a1, a2, a3) { return [a1, a2, a3]; }
53-
static arrayFn4(a1, a2, a3, a4) { return [a1, a2, a3, a4]; }
54-
static arrayFn5(a1, a2, a3, a4, a5) { return [a1, a2, a3, a4, a5]; }
55-
static arrayFn6(a1, a2, a3, a4, a5, a6) { return [a1, a2, a3, a4, a5, a6]; }
56-
static arrayFn7(a1, a2, a3, a4, a5, a6, a7) { return [a1, a2, a3, a4, a5, a6, a7]; }
57-
static arrayFn8(a1, a2, a3, a4, a5, a6, a7, a8) { return [a1, a2, a3, a4, a5, a6, a7, a8]; }
58-
static arrayFn9(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
47+
static uninitialized(): Object { return uninitialized; }
48+
49+
static arrayFn0(): any[] { return []; }
50+
static arrayFn1(a1): any[] { return [a1]; }
51+
static arrayFn2(a1, a2): any[] { return [a1, a2]; }
52+
static arrayFn3(a1, a2, a3): any[] { return [a1, a2, a3]; }
53+
static arrayFn4(a1, a2, a3, a4): any[] { return [a1, a2, a3, a4]; }
54+
static arrayFn5(a1, a2, a3, a4, a5): any[] { return [a1, a2, a3, a4, a5]; }
55+
static arrayFn6(a1, a2, a3, a4, a5, a6): any[] { return [a1, a2, a3, a4, a5, a6]; }
56+
static arrayFn7(a1, a2, a3, a4, a5, a6, a7): any[] { return [a1, a2, a3, a4, a5, a6, a7]; }
57+
static arrayFn8(a1, a2, a3, a4, a5, a6, a7, a8): any[] {
58+
return [a1, a2, a3, a4, a5, a6, a7, a8];
59+
}
60+
static arrayFn9(a1, a2, a3, a4, a5, a6, a7, a8, a9): any[] {
5961
return [a1, a2, a3, a4, a5, a6, a7, a8, a9];
6062
}
6163

62-
static operation_negate(value) { return !value; }
63-
static operation_add(left, right) { return left + right; }
64-
static operation_subtract(left, right) { return left - right; }
65-
static operation_multiply(left, right) { return left * right; }
66-
static operation_divide(left, right) { return left / right; }
67-
static operation_remainder(left, right) { return left % right; }
68-
static operation_equals(left, right) { return left == right; }
69-
static operation_not_equals(left, right) { return left != right; }
70-
static operation_identical(left, right) { return left === right; }
71-
static operation_not_identical(left, right) { return left !== right; }
72-
static operation_less_then(left, right) { return left < right; }
73-
static operation_greater_then(left, right) { return left > right; }
74-
static operation_less_or_equals_then(left, right) { return left <= right; }
75-
static operation_greater_or_equals_then(left, right) { return left >= right; }
76-
static operation_logical_and(left, right) { return left && right; }
77-
static operation_logical_or(left, right) { return left || right; }
78-
static cond(cond, trueVal, falseVal) { return cond ? trueVal : falseVal; }
79-
80-
static mapFn(keys: List<any>) {
81-
function buildMap(values) {
64+
static operation_negate(value): any { return !value; }
65+
static operation_add(left, right): any { return left + right; }
66+
static operation_subtract(left, right): any { return left - right; }
67+
static operation_multiply(left, right): any { return left * right; }
68+
static operation_divide(left, right): any { return left / right; }
69+
static operation_remainder(left, right): any { return left % right; }
70+
static operation_equals(left, right): any { return left == right; }
71+
static operation_not_equals(left, right): any { return left != right; }
72+
static operation_identical(left, right): any { return left === right; }
73+
static operation_not_identical(left, right): any { return left !== right; }
74+
static operation_less_then(left, right): any { return left < right; }
75+
static operation_greater_then(left, right): any { return left > right; }
76+
static operation_less_or_equals_then(left, right): any { return left <= right; }
77+
static operation_greater_or_equals_then(left, right): any { return left >= right; }
78+
static operation_logical_and(left, right): any { return left && right; }
79+
static operation_logical_or(left, right): any { return left || right; }
80+
static cond(cond, trueVal, falseVal): any { return cond ? trueVal : falseVal; }
81+
82+
static mapFn(keys: List<any>): any {
83+
function buildMap(values): StringMap<any, any> {
8284
var res = StringMapWrapper.create();
8385
for (var i = 0; i < keys.length; ++i) {
8486
StringMapWrapper.set(res, keys[i], values[i]);
@@ -113,7 +115,7 @@ export class ChangeDetectionUtil {
113115
}
114116
}
115117

116-
static keyedAccess(obj, args) { return obj[args[0]]; }
118+
static keyedAccess(obj, args): any { return obj[args[0]]; }
117119

118120
static unwrapValue(value: any): any {
119121
if (value instanceof WrappedValue) {
@@ -129,15 +131,15 @@ export class ChangeDetectionUtil {
129131

130132
static throwDehydrated() { throw new DehydratedException(); }
131133

132-
static changeDetectionMode(strategy: string) {
134+
static changeDetectionMode(strategy: string): string {
133135
return strategy == ON_PUSH ? CHECK_ONCE : CHECK_ALWAYS;
134136
}
135137

136138
static simpleChange(previousValue: any, currentValue: any): SimpleChange {
137139
return _simpleChange(previousValue, currentValue);
138140
}
139141

140-
static addChange(changes, propertyName: string, change) {
142+
static addChange(changes, propertyName: string, change): Map<any, any> {
141143
if (isBlank(changes)) {
142144
changes = {};
143145
}

modules/angular2/src/change_detection/dynamic_change_detector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector {
318318
}
319319
}
320320

321-
function isSame(a, b) {
321+
function isSame(a, b): boolean {
322322
if (a === b) return true;
323323
if (a instanceof String && b instanceof String && a == b) return true;
324324
if ((a !== a) && (b !== b)) return true;

0 commit comments

Comments
 (0)