refactor(TypeScript): Add noImplicitAny

We automatically insert explicit 'any's where needed. These need to be
addressed as in #9100.

Fixes #4924
This commit is contained in:
ScottSWu
2016-06-08 15:45:15 -07:00
parent 87d824e1b4
commit 86fbd50c3d
305 changed files with 2338 additions and 2337 deletions

View File

@ -55,16 +55,16 @@ class HelloRootCmp2 {
@Component({selector: 'hello-app', template: ''})
class HelloRootCmp3 {
appBinding;
appBinding: any /** TODO #9100 */;
constructor(@Inject("appBinding") appBinding) { this.appBinding = appBinding; }
constructor(@Inject("appBinding") appBinding: any /** TODO #9100 */) { this.appBinding = appBinding; }
}
@Component({selector: 'hello-app', template: ''})
class HelloRootCmp4 {
appRef;
appRef: any /** TODO #9100 */;
constructor(@Inject(ApplicationRef) appRef) { this.appRef = appRef; }
constructor(@Inject(ApplicationRef) appRef: any /** TODO #9100 */) { this.appRef = appRef; }
}
@Component({selector: 'hello-app'})
@ -78,7 +78,7 @@ class HelloRootDirectiveIsNotCmp {
@Component({selector: 'hello-app', template: ''})
class HelloOnDestroyTickCmp implements OnDestroy {
appRef: ApplicationRef;
constructor(@Inject(ApplicationRef) appRef) { this.appRef = appRef; }
constructor(@Inject(ApplicationRef) appRef: any /** TODO #9100 */) { this.appRef = appRef; }
ngOnDestroy(): void { this.appRef.tick(); }
}
@ -93,12 +93,12 @@ class _ArrayLogger {
class DummyConsole implements Console {
log(message) {}
warn(message) {}
log(message: any /** TODO #9100 */) {}
warn(message: any /** TODO #9100 */) {}
}
export function main() {
var fakeDoc, el, el2, testProviders, lightDom;
var fakeDoc: any /** TODO #9100 */, el: any /** TODO #9100 */, el2: any /** TODO #9100 */, testProviders: any /** TODO #9100 */, lightDom: any /** TODO #9100 */;
describe('bootstrap factory method', () => {
beforeEach(() => {
@ -129,7 +129,7 @@ export function main() {
expect(logger.res.join("")).toContain("Could not compile");
});
it('should throw if no element is found', inject([AsyncTestCompleter], (async) => {
it('should throw if no element is found', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var logger = new _ArrayLogger();
var exceptionHandler = new ExceptionHandler(logger, false);
@ -144,7 +144,7 @@ export function main() {
if (getDOM().supportsDOMEvents()) {
it('should forward the error to promise when bootstrap fails',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
// Skip for dart since it causes a confusing error message in console when test passes.
var logger = new _ArrayLogger();
var exceptionHandler = new ExceptionHandler(logger, false);
@ -159,7 +159,7 @@ export function main() {
}));
it('should invoke the default exception handler when bootstrap fails',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var logger = new _ArrayLogger();
var exceptionHandler = new ExceptionHandler(logger, false);
@ -179,7 +179,7 @@ export function main() {
expect(refPromise).not.toBe(null);
});
it('should display hello world', inject([AsyncTestCompleter], (async) => {
it('should display hello world', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var refPromise = bootstrap(HelloRootCmp, testProviders);
refPromise.then((ref) => {
expect(el).toHaveText('hello world!');
@ -187,7 +187,7 @@ export function main() {
});
}));
it('should support multiple calls to bootstrap', inject([AsyncTestCompleter], (async) => {
it('should support multiple calls to bootstrap', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var refPromise1 = bootstrap(HelloRootCmp, testProviders);
var refPromise2 = bootstrap(HelloRootCmp2, testProviders);
PromiseWrapper.all([refPromise1, refPromise2])
@ -199,7 +199,7 @@ export function main() {
}));
it('should not crash if change detection is invoked when the root component is disposed',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
bootstrap(HelloOnDestroyTickCmp, testProviders)
.then((ref) => {
expect(() => ref.destroy()).not.toThrow();
@ -208,7 +208,7 @@ export function main() {
}));
it('should unregister change detectors when components are disposed',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PLATFORM_PROVIDERS));
var app =
ReflectiveInjector.resolveAndCreate([BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, testProviders],
@ -223,7 +223,7 @@ export function main() {
}));
it("should make the provided bindings available to the application component",
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var refPromise = bootstrap(
HelloRootCmp3, [testProviders, {provide: "appBinding", useValue: "BoundValue"}]);
@ -234,7 +234,7 @@ export function main() {
}));
it("should avoid cyclic dependencies when root component requires Lifecycle through DI",
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var refPromise = bootstrap(HelloRootCmp4, testProviders);
refPromise.then((ref) => {
@ -264,7 +264,7 @@ export function main() {
}));
it('should register each application with the testability registry',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var refPromise1: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp, testProviders);
var refPromise2: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp2, testProviders);

View File

@ -1,3 +1,3 @@
export function createRectangle(left, top, width, height) {
export function createRectangle(left: any /** TODO #9100 */, top: any /** TODO #9100 */, width: any /** TODO #9100 */, height: any /** TODO #9100 */) {
return {left, top, width, height};
}

View File

@ -8,7 +8,7 @@ export class SpyApplicationRef extends SpyObject {
}
export class SpyComponentRef extends SpyObject {
injector;
injector: any /** TODO #9100 */;
constructor() {
super();
this.injector = ReflectiveInjector.resolveAndCreate(
@ -16,6 +16,6 @@ export class SpyComponentRef extends SpyObject {
}
}
export function callNgProfilerTimeChangeDetection(config?): void {
export function callNgProfilerTimeChangeDetection(config?: any /** TODO #9100 */): void {
(<any>global).ng.profiler.timeChangeDetection(config);
}

View File

@ -19,7 +19,7 @@ import {
import {el} from '../../../testing/browser_util';
export function main() {
var domEventPlugin;
var domEventPlugin: any /** TODO #9100 */;
describe('EventManager', () => {
@ -28,7 +28,7 @@ export function main() {
it('should delegate event bindings to plugins that are passed in from the most generic one to the most specific one',
() => {
var element = el('<div></div>');
var handler = (e) => e;
var handler = (e: any /** TODO #9100 */) => e;
var plugin = new FakeEventManagerPlugin(['click']);
var manager = new EventManager([domEventPlugin, plugin], new FakeNgZone());
manager.addEventListener(element, 'click', handler);
@ -37,8 +37,8 @@ export function main() {
it('should delegate event bindings to the first plugin supporting the event', () => {
var element = el('<div></div>');
var clickHandler = (e) => e;
var dblClickHandler = (e) => e;
var clickHandler = (e: any /** TODO #9100 */) => e;
var dblClickHandler = (e: any /** TODO #9100 */) => e;
var plugin1 = new FakeEventManagerPlugin(['dblclick']);
var plugin2 = new FakeEventManagerPlugin(['click', 'dblclick']);
var manager = new EventManager([plugin2, plugin1], new FakeNgZone());
@ -65,8 +65,8 @@ export function main() {
var child = getDOM().firstChild(element);
var dispatchedEvent = getDOM().createMouseEvent('click');
var receivedEvent = null;
var handler = (e) => { receivedEvent = e; };
var receivedEvent: any /** TODO #9100 */ = null;
var handler = (e: any /** TODO #9100 */) => { receivedEvent = e; };
var manager = new EventManager([domEventPlugin], new FakeNgZone());
manager.addEventListener(element, 'click', handler);
getDOM().dispatchEvent(child, dispatchedEvent);
@ -78,8 +78,8 @@ export function main() {
var element = el('<div><div></div></div>');
getDOM().appendChild(getDOM().defaultDoc().body, element);
var dispatchedEvent = getDOM().createMouseEvent('click');
var receivedEvent = null;
var handler = (e) => { receivedEvent = e; };
var receivedEvent: any /** TODO #9100 */ = null;
var handler = (e: any /** TODO #9100 */) => { receivedEvent = e; };
var manager = new EventManager([domEventPlugin], new FakeNgZone());
var remover = manager.addGlobalEventListener("document", 'click', handler);
@ -100,7 +100,7 @@ class FakeEventManagerPlugin extends EventManagerPlugin {
supports(eventName: string): boolean { return ListWrapper.contains(this._supports, eventName); }
addEventListener(element, eventName: string, handler: Function) {
addEventListener(element: any /** TODO #9100 */, eventName: string, handler: Function) {
this._eventHandler.set(eventName, handler);
return () => { this._eventHandler.delete(eventName); };
}
@ -108,7 +108,7 @@ class FakeEventManagerPlugin extends EventManagerPlugin {
class FakeNgZone extends NgZone {
constructor() { super({enableLongStackTrace: false}); }
run(fn) { fn(); }
run(fn: any /** TODO #9100 */) { fn(); }
runOutsideAngular(fn) { return fn(); }
runOutsideAngular(fn: any /** TODO #9100 */) { return fn(); }
}

View File

@ -15,7 +15,7 @@ import {DomSharedStylesHost} from '@angular/platform-browser/src/dom/shared_styl
export function main() {
describe('DomSharedStylesHost', () => {
var doc;
var doc: any /** TODO #9100 */;
var ssh: DomSharedStylesHost;
var someHost: Element;
beforeEach(() => {

View File

@ -58,7 +58,7 @@ export function main() {
}
describe('WebAnimationsPlayer', () => {
var player, captures;
var player: any /** TODO #9100 */, captures: any /** TODO #9100 */;
beforeEach(() => {
var newPlayer = makePlayer();
captures = <{[key: string]: any}>newPlayer['captures'];

View File

@ -123,11 +123,11 @@ export function main() {
beforeEachProviders(() => [{provide: FancyService, useValue: new FancyService()}]);
it('provides a real XHR instance',
inject([XHR], (xhr) => { expect(xhr).toBeAnInstanceOf(XHRImpl); }));
inject([XHR], (xhr: any /** TODO #9100 */) => { expect(xhr).toBeAnInstanceOf(XHRImpl); }));
it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service) => {
var value;
service.getAsyncValue().then(function(val) { value = val; });
it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service: any /** TODO #9100 */) => {
var value: any /** TODO #9100 */;
service.getAsyncValue().then(function(val: any /** TODO #9100 */) { value = val; });
tick();
expect(value).toEqual('async value');
})));
@ -140,9 +140,9 @@ export function main() {
var patchJasmineIt = () => {
var deferred = PromiseWrapper.completer();
originalJasmineIt = jasmine.getEnv().it;
jasmine.getEnv().it = (description: string, fn) => {
jasmine.getEnv().it = (description: string, fn: any /** TODO #9100 */) => {
var done = () => { deferred.resolve() };
(<any>done).fail = (err) => { deferred.reject(err) };
(<any>done).fail = (err: any /** TODO #9100 */) => { deferred.reject(err) };
fn(done);
return null;
};
@ -151,12 +151,12 @@ export function main() {
var restoreJasmineIt = () => { jasmine.getEnv().it = originalJasmineIt; };
it('should fail when an XHR fails', (done) => {
it('should fail when an XHR fails', (done: any /** TODO #9100 */) => {
var itPromise = patchJasmineIt();
it('should fail with an error from a promise',
async(inject([TestComponentBuilder],
(tcb) => { return tcb.createAsync(BadTemplateUrl); })));
(tcb: any /** TODO #9100 */) => { return tcb.createAsync(BadTemplateUrl); })));
itPromise.then(() => { done.fail('Expected test to fail, but it did not'); }, (err) => {
expect(err).toEqual('Uncaught (in promise): Failed to load non-existant.html');

View File

@ -116,7 +116,7 @@ export function main() {
it('should run normal tests', () => { actuallyDone = true; });
it('should run normal async tests', (done) => {
it('should run normal async tests', (done: any /** TODO #9100 */) => {
setTimeout(() => {
actuallyDone = true;
done();
@ -137,22 +137,22 @@ export function main() {
beforeEachProviders(() => [{provide: FancyService, useValue: new FancyService()}]);
it('should use set up providers',
inject([FancyService], (service) => { expect(service.value).toEqual('real value'); }));
inject([FancyService], (service: any /** TODO #9100 */) => { expect(service.value).toEqual('real value'); }));
it('should wait until returned promises', async(inject([FancyService], (service) => {
service.getAsyncValue().then((value) => { expect(value).toEqual('async value'); });
service.getTimeoutValue().then((value) => { expect(value).toEqual('timeout value'); });
it('should wait until returned promises', async(inject([FancyService], (service: any /** TODO #9100 */) => {
service.getAsyncValue().then((value: any /** TODO #9100 */) => { expect(value).toEqual('async value'); });
service.getTimeoutValue().then((value: any /** TODO #9100 */) => { expect(value).toEqual('timeout value'); });
})));
it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service) => {
var value;
service.getAsyncValue().then(function(val) { value = val; });
it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service: any /** TODO #9100 */) => {
var value: any /** TODO #9100 */;
service.getAsyncValue().then(function(val: any /** TODO #9100 */) { value = val; });
tick();
expect(value).toEqual('async value');
})));
it('should allow use of "done"', (done) => {
inject([FancyService], (service) => {
it('should allow use of "done"', (done: any /** TODO #9100 */) => {
inject([FancyService], (service: any /** TODO #9100 */) => {
let count = 0;
let id = setInterval(() => {
count++;
@ -166,20 +166,20 @@ export function main() {
describe('using beforeEach', () => {
beforeEach(inject([FancyService],
(service) => { service.value = 'value modified in beforeEach'; }));
(service: any /** TODO #9100 */) => { service.value = 'value modified in beforeEach'; }));
it('should use modified providers', inject([FancyService], (service) => {
it('should use modified providers', inject([FancyService], (service: any /** TODO #9100 */) => {
expect(service.value).toEqual('value modified in beforeEach');
}));
});
describe('using async beforeEach', () => {
beforeEach(async(inject([FancyService], (service) => {
service.getAsyncValue().then((value) => { service.value = value; });
beforeEach(async(inject([FancyService], (service: any /** TODO #9100 */) => {
service.getAsyncValue().then((value: any /** TODO #9100 */) => { service.value = value; });
})));
it('should use asynchronously modified value',
inject([FancyService], (service) => { expect(service.value).toEqual('async value'); }));
inject([FancyService], (service: any /** TODO #9100 */) => { expect(service.value).toEqual('async value'); }));
});
});
@ -187,11 +187,11 @@ export function main() {
it('should allow per test providers',
withProviders(() => [{provide: FancyService, useValue: new FancyService()}])
.inject([FancyService],
(service) => { expect(service.value).toEqual('real value'); }));
(service: any /** TODO #9100 */) => { expect(service.value).toEqual('real value'); }));
it('should return value from inject', () => {
let retval = withProviders(() => [{provide: FancyService, useValue: new FancyService()}])
.inject([FancyService], (service) => {
.inject([FancyService], (service: any /** TODO #9100 */) => {
expect(service.value).toEqual('real value');
return 10;
})();
@ -207,9 +207,9 @@ export function main() {
var patchJasmineIt = () => {
var deferred = PromiseWrapper.completer();
originalJasmineIt = jasmine.getEnv().it;
jasmine.getEnv().it = (description: string, fn) => {
jasmine.getEnv().it = (description: string, fn: any /** TODO #9100 */) => {
var done = () => { deferred.resolve() };
(<any>done).fail = (err) => { deferred.reject(err) };
(<any>done).fail = (err: any /** TODO #9100 */) => { deferred.reject(err) };
fn(done);
return null;
};
@ -223,7 +223,7 @@ export function main() {
originalJasmineBeforeEach = jasmine.getEnv().beforeEach;
jasmine.getEnv().beforeEach = (fn: any) => {
var done = () => { deferred.resolve() };
(<any>done).fail = (err) => { deferred.reject(err) };
(<any>done).fail = (err: any /** TODO #9100 */) => { deferred.reject(err) };
fn(done);
return null;
};
@ -233,7 +233,7 @@ export function main() {
var restoreJasmineBeforeEach =
() => { jasmine.getEnv().beforeEach = originalJasmineBeforeEach; };
it('should fail when an asynchronous error is thrown', (done) => {
it('should fail when an asynchronous error is thrown', (done: any /** TODO #9100 */) => {
var itPromise = patchJasmineIt();
it('throws an async error',
@ -246,7 +246,7 @@ export function main() {
restoreJasmineIt();
});
it('should fail when a returned promise is rejected', (done) => {
it('should fail when a returned promise is rejected', (done: any /** TODO #9100 */) => {
var itPromise = patchJasmineIt();
it('should fail with an error from a promise', async(inject([], () => {
@ -268,7 +268,7 @@ export function main() {
beforeEachProviders(() => [{provide: FancyService, useValue: new FancyService()}]);
beforeEach(
inject([FancyService], (service) => { expect(service.value).toEqual('real value'); }));
inject([FancyService], (service: any /** TODO #9100 */) => { expect(service.value).toEqual('real value'); }));
describe('nested beforeEachProviders', () => {

View File

@ -24,7 +24,7 @@ export function main() {
beforeEach(() => { bus = createConnectedMessageBus(); });
it("should pass messages in the same channel from sink to source",
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
const CHANNEL = "CHANNEL 1";
const MESSAGE = "Test message";
bus.initChannel(CHANNEL, false);
@ -38,7 +38,7 @@ export function main() {
ObservableWrapper.callEmit(toEmitter, MESSAGE);
}));
it("should broadcast", inject([AsyncTestCompleter], (async) => {
it("should broadcast", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
const CHANNEL = "CHANNEL 1";
const MESSAGE = "TESTING";
const NUM_LISTENERS = 2;
@ -62,7 +62,7 @@ export function main() {
ObservableWrapper.callEmit(toEmitter, MESSAGE);
}));
it("should keep channels independent", inject([AsyncTestCompleter], (async) => {
it("should keep channels independent", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
const CHANNEL_ONE = "CHANNEL 1";
const CHANNEL_TWO = "CHANNEL 2";
const MESSAGE_ONE = "This is a message on CHANNEL 1";
@ -114,7 +114,7 @@ export function main() {
it("should buffer messages and wait for the zone to exit before sending",
withProviders(() => [{provide: NgZone, useClass: MockNgZone}])
.inject([AsyncTestCompleter, NgZone],
(async, zone: MockNgZone) => {
(async: any /** TODO #9100 */, zone: MockNgZone) => {
bus = createConnectedMessageBus();
setup(true, zone);
@ -137,7 +137,7 @@ export function main() {
500);
it("should send messages immediatly when run outside the zone",
inject([AsyncTestCompleter, NgZone], (async, zone: MockNgZone) => {
inject([AsyncTestCompleter, NgZone], (async: any /** TODO #9100 */, zone: MockNgZone) => {
bus = createConnectedMessageBus();
setup(false, zone);

View File

@ -30,7 +30,7 @@ export function main() {
beforeEachProviders(() => [Serializer, {provide: ON_WEB_WORKER, useValue: true}, RenderStore]);
describe("UIMessageBroker", () => {
var messageBuses;
var messageBuses: any /** TODO #9100 */;
beforeEach(() => {
messageBuses = createPairedMessageBuses();
@ -38,7 +38,7 @@ export function main() {
messageBuses.worker.initChannel(CHANNEL);
});
it("should call registered method with correct arguments",
inject([Serializer], (serializer) => {
inject([Serializer], (serializer: any /** TODO #9100 */) => {
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
broker.registerMethod(TEST_METHOD, [PRIMITIVE, PRIMITIVE], (arg1, arg2) => {
expect(arg1).toEqual(PASSED_ARG_1);
@ -51,7 +51,7 @@ export function main() {
// TODO(pkozlowski): this fails only in Edge with
// "No provider for RenderStore! (Serializer -> RenderStore)"
if (!browserDetection.isEdge) {
it("should return promises to the worker", inject([Serializer], (serializer) => {
it("should return promises to the worker", inject([Serializer], (serializer: any /** TODO #9100 */) => {
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
broker.registerMethod(TEST_METHOD, [PRIMITIVE], (arg1) => {
expect(arg1).toEqual(PASSED_ARG_1);

View File

@ -51,7 +51,7 @@ export function expectBrokerCall(broker: SpyMessageBroker, methodName: string, v
expect(args.args.length).toEqual(vals.length);
ListWrapper.forEachWithIndex(vals, (v, i) => {expect(v).toEqual(args.args[i].value)});
}
var promise = null;
var promise: any /** TODO #9100 */ = null;
if (isPresent(handler)) {
let givenValues = args.args.map((arg) => {arg.value});
if (givenValues.length > 0) {

View File

@ -81,7 +81,7 @@ export function main() {
expect(() => platformLocation.pathname = "TEST").toThrowError();
});
it("should send pathname to render thread", inject([AsyncTestCompleter], (async) => {
it("should send pathname to render thread", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
let platformLocation = createWebWorkerPlatformLocation(TEST_LOCATION);
platformLocation.init().then((_) => {
let PATHNAME = "/test";

View File

@ -100,7 +100,7 @@ export function main() {
{provide: RenderStore, useValue: workerRenderStore},
{
provide: RootRenderer,
useFactory: (workerSerializer) => {
useFactory: (workerSerializer: any /** TODO #9100 */) => {
return createWorkerRenderer(workerSerializer, uiSerializer, domRootRenderer,
uiRenderStore, workerRenderStore);
},
@ -119,7 +119,7 @@ export function main() {
}
it('should update text nodes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideView(MyComp2, new ViewMetadata({template: '<div>{{ctxProp}}</div>'}))
.createAsync(MyComp2)
.then((fixture) => {
@ -135,12 +135,12 @@ export function main() {
}));
it('should update any element property/attributes/class/style(s) independent of the compilation on the root element and other elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideView(MyComp2, new ViewMetadata(
{template: '<input [title]="y" style="position:absolute">'}))
.createAsync(MyComp2)
.then((fixture) => {
var checkSetters = (componentRef, workerEl) => {
var checkSetters = (componentRef: any /** TODO #9100 */, workerEl: any /** TODO #9100 */) => {
var renderer = getRenderer(componentRef);
var el = getRenderElement(workerEl);
renderer.setElementProperty(workerEl, 'tabIndex', 1);
@ -170,7 +170,7 @@ export function main() {
}));
it('should update any template comment property/attributes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
var tpl = '<template [ngIf]="ctxBoolProp"></template>';
tcb.overrideView(MyComp2, new ViewMetadata({template: tpl, directives: [NgIf]}))
@ -185,7 +185,7 @@ export function main() {
}));
it('should add and remove fragments',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideView(MyComp2, new ViewMetadata({
template: '<template [ngIf]="ctxBoolProp">hello</template>',
directives: [NgIf]
@ -210,7 +210,7 @@ export function main() {
if (getDOM().supportsDOMEvents()) {
it('should call actions on the element',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideView(MyComp2, new ViewMetadata({template: '<input [title]="y">'}))
.createAsync(MyComp2)
.then((fixture) => {
@ -225,7 +225,7 @@ export function main() {
}));
it('should listen to events',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideView(MyComp2,
new ViewMetadata({template: '<input (change)="ctxNumProp = 1">'}))
.createAsync(MyComp2)
@ -248,7 +248,7 @@ export function main() {
@Injectable()
class MyComp2 {
ctxProp: string;
ctxNumProp;
ctxNumProp: any /** TODO #9100 */;
ctxBoolProp: boolean;
constructor() {
this.ctxProp = 'initial value';

View File

@ -1,3 +1,3 @@
export function setTemplateCache(cache): void {
export function setTemplateCache(cache: any /** TODO #9100 */): void {
(<any>window).$templateCache = cache;
}

View File

@ -43,7 +43,7 @@ export function main() {
});
it('should resolve the Promise with the cached file content on success',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
setTemplateCache({'test.html': '<div>Hello</div>'});
xhr = new CachedXHR();
xhr.get('test.html')
@ -53,7 +53,7 @@ export function main() {
});
}));
it('should reject the Promise on failure', inject([AsyncTestCompleter], (async) => {
it('should reject the Promise on failure', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
xhr = new CachedXHR();
xhr.get('unknown.html')
.then((text) => { throw new BaseException('Not expected to succeed.'); })

View File

@ -28,14 +28,14 @@ export function main() {
beforeEach(() => { xhr = new XHRImpl(); });
it('should resolve the Promise with the file content on success',
inject([AsyncTestCompleter], (async) => {
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
xhr.get(url200).then((text) => {
expect(text.trim()).toEqual('<p>hey</p>');
async.done();
});
}), 10000);
it('should reject the Promise on failure', inject([AsyncTestCompleter], (async) => {
it('should reject the Promise on failure', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
PromiseWrapper.catchError(xhr.get(url404), (e) => {
expect(e).toEqual(`Failed to load ${url404}`);
async.done();