Skip to content

Commit 030a4ac

Browse files
committed
chore: fix errors from ts2dart update
1 parent 27439a0 commit 030a4ac

File tree

8 files changed

+41
-39
lines changed

8 files changed

+41
-39
lines changed

modules/angular2/platform/browser_static.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export {
1111
disableDebugTools
1212
} from 'angular2/src/platform/browser_common';
1313

14-
import {Type, isPresent} from 'angular2/src/facade/lang';
14+
import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
1515
import {
1616
BROWSER_PROVIDERS,
1717
BROWSER_APP_COMMON_PROVIDERS
@@ -24,7 +24,7 @@ import {ComponentRef, platform} from 'angular2/core';
2424
* have been precompiled offline.
2525
*/
2626
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
27-
BROWSER_APP_COMMON_PROVIDERS;
27+
CONST_EXPR(BROWSER_APP_COMMON_PROVIDERS);
2828

2929
/**
3030
* See {@link bootstrap} for more information.

modules/angular2/src/common/forms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ export const FORM_PROVIDERS: Type[] = CONST_EXPR([FormBuilder, RadioControlRegis
6161
*
6262
* @deprecated
6363
*/
64-
export const FORM_BINDINGS = FORM_PROVIDERS;
64+
export const FORM_BINDINGS = CONST_EXPR(FORM_PROVIDERS);

modules/angular2/src/common/forms/directives/validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {NumberWrapper} from "angular2/src/facade/lang";
2626
*/
2727
export interface Validator { validate(c: modelModule.AbstractControl): {[key: string]: any}; }
2828

29-
const REQUIRED = Validators.required;
29+
const REQUIRED = CONST_EXPR(Validators.required);
3030

3131
const REQUIRED_VALIDATOR =
3232
CONST_EXPR(new Provider(NG_VALIDATORS, {useValue: REQUIRED, multi: true}));

modules/angular2/src/core/application_ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ export class ApplicationRef_ extends ApplicationRef {
450450
}
451451
});
452452
return completer.promise.then<ComponentRef>((ref: ComponentRef) => {
453-
let c = this._injector.get(Console);
453+
let c: Console = this._injector.get(Console);
454454
if (assertionsEnabled()) {
455455
c.log(
456456
"Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.");

modules/angular2/src/router/router_providers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ export const ROUTER_PROVIDERS: any[] = CONST_EXPR([
4040
*
4141
* @deprecated
4242
*/
43-
export const ROUTER_BINDINGS = ROUTER_PROVIDERS;
43+
export const ROUTER_BINDINGS = CONST_EXPR(ROUTER_PROVIDERS);

modules/angular2/test/core/change_detection/change_detector_spec.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function main() {
110110
function _bindSimpleValue(expression: string, context = _DEFAULT_CONTEXT) {
111111
var val = _createChangeDetector(expression, context);
112112
val.changeDetector.detectChanges();
113-
return val.dispatcher.log;
113+
return (<TestDispatcher>val.dispatcher).log;
114114
}
115115

116116
describe('short-circuit', () => {
@@ -316,64 +316,64 @@ export function main() {
316316
var val = _createChangeDetector('age', person);
317317

318318
val.changeDetector.detectChanges();
319-
expect(val.dispatcher.log).toEqual(['propName=NaN']);
319+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=NaN']);
320320
val.dispatcher.clear();
321321

322322
val.changeDetector.detectChanges();
323-
expect(val.dispatcher.log).toEqual([]);
323+
expect((<TestDispatcher>val.dispatcher).log).toEqual([]);
324324
});
325325

326326
it('should do simple watching', () => {
327327
var person = new Person('misko');
328328
var val = _createChangeDetector('name', person);
329329

330330
val.changeDetector.detectChanges();
331-
expect(val.dispatcher.log).toEqual(['propName=misko']);
331+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=misko']);
332332
val.dispatcher.clear();
333333

334334
val.changeDetector.detectChanges();
335-
expect(val.dispatcher.log).toEqual([]);
335+
expect((<TestDispatcher>val.dispatcher).log).toEqual([]);
336336
val.dispatcher.clear();
337337

338338
person.name = 'Misko';
339339
val.changeDetector.detectChanges();
340-
expect(val.dispatcher.log).toEqual(['propName=Misko']);
340+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=Misko']);
341341
});
342342

343343
it('should support literal array', () => {
344344
var val = _createChangeDetector('[1, 2]');
345345
val.changeDetector.detectChanges();
346-
expect(val.dispatcher.loggedValues).toEqual([[1, 2]]);
346+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual([[1, 2]]);
347347

348348
val = _createChangeDetector('[1, a]', new TestData(2));
349349
val.changeDetector.detectChanges();
350-
expect(val.dispatcher.loggedValues).toEqual([[1, 2]]);
350+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual([[1, 2]]);
351351
});
352352

353353
it('should support literal maps', () => {
354354
var val = _createChangeDetector('{z: 1}');
355355
val.changeDetector.detectChanges();
356-
expect(val.dispatcher.loggedValues[0]['z']).toEqual(1);
356+
expect((<TestDispatcher>val.dispatcher).loggedValues[0]['z']).toEqual(1);
357357

358358
val = _createChangeDetector('{z: a}', new TestData(1));
359359
val.changeDetector.detectChanges();
360-
expect(val.dispatcher.loggedValues[0]['z']).toEqual(1);
360+
expect((<TestDispatcher>val.dispatcher).loggedValues[0]['z']).toEqual(1);
361361
});
362362

363363
it('should support interpolation', () => {
364364
var val = _createChangeDetector('interpolation', new TestData('value'));
365365

366366
val.changeDetector.detectChanges();
367367

368-
expect(val.dispatcher.log).toEqual(['propName=BvalueA']);
368+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=BvalueA']);
369369
});
370370

371371
it('should output empty strings for null values in interpolation', () => {
372372
var val = _createChangeDetector('interpolation', new TestData(null));
373373

374374
val.changeDetector.detectChanges();
375375

376-
expect(val.dispatcher.log).toEqual(['propName=BA']);
376+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=BA']);
377377
});
378378

379379
it('should escape values in literals that indicate interpolation',
@@ -385,7 +385,7 @@ export function main() {
385385
var val = _createChangeDetector('passThrough([12])', person);
386386
val.changeDetector.detectChanges();
387387
val.changeDetector.detectChanges();
388-
expect(val.dispatcher.loggedValues).toEqual([[12]]);
388+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual([[12]]);
389389
});
390390
});
391391

@@ -395,7 +395,7 @@ export function main() {
395395
var person = new Person('bob');
396396
var val = _createChangeDetector('name', person);
397397
val.changeDetector.detectChanges();
398-
expect(val.dispatcher.loggedValues).toEqual(['bob']);
398+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual(['bob']);
399399
});
400400
});
401401

@@ -405,7 +405,7 @@ export function main() {
405405
var person = new Person('bob');
406406
var val = _createChangeDetector('name | pipe', person, registry);
407407
val.changeDetector.detectChanges();
408-
expect(val.dispatcher.loggedValues).toEqual(['bob state:0']);
408+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual(['bob state:0']);
409409
});
410410

411411
it('should support arguments in pipes', () => {
@@ -414,15 +414,17 @@ export function main() {
414414
var person = new Person('value', address);
415415
var val = _createChangeDetector("name | pipe:'one':address.city", person, registry);
416416
val.changeDetector.detectChanges();
417-
expect(val.dispatcher.loggedValues).toEqual(['value one two default']);
417+
expect((<TestDispatcher>val.dispatcher).loggedValues)
418+
.toEqual(['value one two default']);
418419
});
419420

420421
it('should associate pipes right-to-left', () => {
421422
var registry = new FakePipes('pipe', () => new MultiArgPipe());
422423
var person = new Person('value');
423424
var val = _createChangeDetector("name | pipe:'a':'b' | pipe:0:1:2", person, registry);
424425
val.changeDetector.detectChanges();
425-
expect(val.dispatcher.loggedValues).toEqual(['value a b default 0 1 2']);
426+
expect((<TestDispatcher>val.dispatcher).loggedValues)
427+
.toEqual(['value a b default 0 1 2']);
426428
});
427429

428430
it('should not reevaluate pure pipes unless its context or arg changes', () => {
@@ -460,7 +462,7 @@ export function main() {
460462
var person = new Person('bob');
461463
var val = _createChangeDetector('(name | pipe).length', person, registry);
462464
val.changeDetector.detectChanges();
463-
expect(val.dispatcher.loggedValues).toEqual([3]);
465+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual([3]);
464466
});
465467
});
466468

@@ -492,7 +494,7 @@ export function main() {
492494
val.changeDetector.hydrate(_DEFAULT_CONTEXT, null, new TestDispatcher([directive1], []),
493495
null);
494496
val.changeDetector.detectChanges();
495-
expect(val.dispatcher.loggedValues).toEqual([]);
497+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual([]);
496498
expect(directive1.a).toEqual(42);
497499
});
498500

@@ -874,7 +876,7 @@ export function main() {
874876

875877
val.changeDetector.detectChanges();
876878

877-
expect(val.dispatcher.loggedValues).toEqual(['aaa']);
879+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual(['aaa']);
878880
});
879881
});
880882

@@ -900,7 +902,7 @@ export function main() {
900902
'Expression [\'"]a in location[\'"] has changed after it was checked.'));
901903

902904
val.changeDetector.detectChanges();
903-
expect(val.dispatcher.loggedValues).toEqual(['value']);
905+
expect((<TestDispatcher>val.dispatcher).loggedValues).toEqual(['value']);
904906
});
905907
});
906908

@@ -1021,7 +1023,7 @@ export function main() {
10211023
val.changeDetector.mode = ChangeDetectionStrategy.Detached;
10221024
val.changeDetector.detectChanges();
10231025

1024-
expect(val.dispatcher.log).toEqual([]);
1026+
expect((<TestDispatcher>val.dispatcher).log).toEqual([]);
10251027
});
10261028

10271029
it('should not check a checked change detector', () => {
@@ -1031,7 +1033,7 @@ export function main() {
10311033
val.changeDetector.mode = ChangeDetectionStrategy.Checked;
10321034
val.changeDetector.detectChanges();
10331035

1034-
expect(val.dispatcher.log).toEqual([]);
1036+
expect((<TestDispatcher>val.dispatcher).log).toEqual([]);
10351037
});
10361038

10371039
it('should change CheckOnce to Checked', () => {
@@ -1173,12 +1175,12 @@ export function main() {
11731175
var val = _createChangeDetector('name', context);
11741176

11751177
val.changeDetector.detectChanges();
1176-
expect(val.dispatcher.log).toEqual(['propName=Bob']);
1178+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=Bob']);
11771179

11781180
val.changeDetector.dehydrate();
11791181
expect(() => {val.changeDetector.detectChanges()})
11801182
.toThrowErrorWith("Attempt to use a dehydrated detector");
1181-
expect(val.dispatcher.log).toEqual(['propName=Bob']);
1183+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=Bob']);
11821184
});
11831185
});
11841186

@@ -1190,12 +1192,12 @@ export function main() {
11901192

11911193
val.changeDetector.detectChanges();
11921194

1193-
expect(val.dispatcher.log).toEqual(['propName=Megatron']);
1195+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=Megatron']);
11941196

11951197
val.dispatcher.clear();
11961198
val.changeDetector.detectChanges();
11971199

1198-
expect(val.dispatcher.log).toEqual([]);
1200+
expect((<TestDispatcher>val.dispatcher).log).toEqual([]);
11991201
});
12001202

12011203
it('should unwrap the wrapped value', () => {
@@ -1206,7 +1208,7 @@ export function main() {
12061208

12071209
val.changeDetector.detectChanges();
12081210

1209-
expect(val.dispatcher.log).toEqual(['propName=Megatron']);
1211+
expect((<TestDispatcher>val.dispatcher).log).toEqual(['propName=Megatron']);
12101212
});
12111213

12121214
describe('handleEvent', () => {

modules/angular2/test/core/debug/debug_node_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ export function main() {
351351
.then((fixture) => {
352352
fixture.detectChanges();
353353

354-
expect(fixture.debugElement.children[0].inject(Logger).log)
355-
.toEqual(['parent', 'nestedparent', 'child', 'nestedchild']);
354+
var logger: Logger = fixture.debugElement.children[0].inject(Logger);
355+
expect(logger.log).toEqual(['parent', 'nestedparent', 'child', 'nestedchild']);
356356

357357
async.done();
358358
});

modules/angular2/test/core/linker/query_integration_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function main() {
9090
view.debugElement.componentInstance.shouldShow = true;
9191
view.detectChanges();
9292

93-
var q = view.debugElement.children[0].getLocal('q');
93+
var q: NeedsContentChild = view.debugElement.children[0].getLocal('q');
9494

9595
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
9696

@@ -119,7 +119,7 @@ export function main() {
119119
.createAsync(MyComp)
120120
.then((view) => {
121121
view.detectChanges();
122-
var q = view.debugElement.children[0].getLocal('q');
122+
var q: NeedsViewChild = view.debugElement.children[0].getLocal('q');
123123

124124
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
125125

@@ -148,7 +148,7 @@ export function main() {
148148
.createAsync(MyComp)
149149
.then((view) => {
150150
view.detectChanges();
151-
var q = view.debugElement.children[0].getLocal('q');
151+
var q: NeedsViewChild = view.debugElement.children[0].getLocal('q');
152152

153153
expect(q.log).toEqual([["setter", "foo"], ["init", "foo"], ["check", "foo"]]);
154154

0 commit comments

Comments
 (0)