Skip to content

Commit 75db2c5

Browse files
committed
chore: add more types to a number of top-level properties and methods
1 parent c8ebd11 commit 75db2c5

File tree

9 files changed

+25
-29
lines changed

9 files changed

+25
-29
lines changed

modules/angular2/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {Location} from './src/router/location';
2020
import {appComponentAnnotatedTypeToken} from './src/core/application_tokens';
2121
import {bind} from './di';
2222

23-
export var routerInjectables = [
23+
export var routerInjectables:List = [
2424
RouteRegistry,
2525
Pipeline,
2626
Location,

modules/angular2/src/change_detection/change_detection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ export class JitChangeDetection extends ChangeDetection {
9393
}
9494
}
9595

96-
export var defaultPipeRegistry = new PipeRegistry(defaultPipes);
96+
export var defaultPipeRegistry:PipeRegistry = new PipeRegistry(defaultPipes);

modules/angular2/src/dom/browser_adapter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
134134
}
135135
MouseEvent createMouseEvent(String eventType) =>
136136
new MouseEvent(eventType, canBubble: true);
137-
Event createEvent(eventType) => new Event(eventType, canBubble: true);
137+
Event createEvent(String eventType) => new Event(eventType, canBubble: true);
138138
String getInnerHTML(Element el) => el.innerHtml;
139139
String getOuterHTML(Element el) => el.outerHtml;
140140
void setInnerHTML(Element el, String value) {

modules/angular2/src/dom/dom_adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class DomAdapter {
5252
createMouseEvent(eventType) {
5353
throw _abstract();
5454
}
55-
createEvent(eventType) {
55+
createEvent(eventType:string) {
5656
throw _abstract();
5757
}
5858
getInnerHTML(el) {

modules/angular2/src/dom/html_adapter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class Html5LibDomAdapter implements DomAdapter {
146146
setChecked(el, bool value) {
147147
throw 'not implemented';
148148
}
149-
createTemplate(html) => createElement('template')..innerHtml = html;
149+
createTemplate(String html) => createElement('template')..innerHtml = html;
150150
createElement(tagName, [doc]) {
151151
return new Element.tag(tagName);
152152
}

modules/angular2/src/forms/directives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,6 @@ export class ControlGroupDirective {
272272
* @exportedAs angular2/forms
273273
*/
274274
// todo(misko): rename to lover case as it is not a Type but a var.
275-
export var FormDirectives = [
275+
export var FormDirectives:List = [
276276
ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor
277277
];

modules/angular2/src/test_lib/test_injector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function _getAppBindings() {
118118
];
119119
}
120120

121-
export function createTestInjector(bindings: List) {
121+
export function createTestInjector(bindings: List):Injector {
122122
var rootInjector = Injector.resolveAndCreate(_getRootBindings());
123123
return rootInjector.resolveAndCreateChild(ListWrapper.concat(_getAppBindings(), bindings));
124124
}
@@ -153,7 +153,7 @@ export function createTestInjector(bindings: List) {
153153
* @return {FunctionWithParamTokens}
154154
* @exportedAs angular2/test
155155
*/
156-
export function inject(tokens: List, fn: Function) {
156+
export function inject(tokens: List, fn: Function):FunctionWithParamTokens {
157157
return new FunctionWithParamTokens(tokens, fn);
158158
}
159159

@@ -166,7 +166,7 @@ export class FunctionWithParamTokens {
166166
this._fn = fn;
167167
}
168168

169-
execute(injector: Injector) {
169+
execute(injector: Injector):void {
170170
var params = ListWrapper.map(this._tokens, (t) => injector.get(t));
171171
FunctionWrapper.apply(this._fn, params);
172172
}

modules/angular2/src/test_lib/test_lib.dart

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,16 @@ bool _isCurrentTestAsync;
2626
bool _inIt = false;
2727

2828
class AsyncTestCompleter {
29-
Completer _completer;
29+
final _completer = new Completer();
3030

31-
AsyncTestCompleter() {
32-
_completer = new Completer();
33-
}
34-
35-
done() {
31+
void done() {
3632
_completer.complete();
3733
}
3834

39-
get future => _completer.future;
35+
Future get future => _completer.future;
4036
}
4137

42-
testSetup() {
38+
void testSetup() {
4339
reflector.reflectionCapabilities = new ReflectionCapabilities();
4440
// beforeEach configuration:
4541
// - Priority 3: clear the bindings before each test,
@@ -125,7 +121,7 @@ class NotExpect extends gns.NotExpect {
125121
Function get _expect => gns.guinness.matchers.expect;
126122
}
127123

128-
beforeEach(fn) {
124+
void beforeEach(fn) {
129125
if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn);
130126
gns.beforeEach(() {
131127
fn.execute(_injector);
@@ -144,7 +140,7 @@ beforeEach(fn) {
144140
* bind(SomeToken).toValue(myValue),
145141
* ]);
146142
*/
147-
beforeEachBindings(fn) {
143+
void beforeEachBindings(Function fn) {
148144
gns.beforeEach(
149145
() {
150146
var bindings = fn();
@@ -154,7 +150,7 @@ beforeEachBindings(fn) {
154150
);
155151
}
156152

157-
_it(gnsFn, name, fn) {
153+
void _it(gnsFn, name, fn) {
158154
if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn);
159155
gnsFn(name, () {
160156
_inIt = true;
@@ -165,20 +161,20 @@ _it(gnsFn, name, fn) {
165161
}
166162

167163

168-
it(name, fn) {
164+
void it(name, fn) {
169165
_it(gns.it, name, fn);
170166
}
171167

172-
iit(name, fn) {
168+
void iit(name, fn) {
173169
_it(gns.iit, name, fn);
174170
}
175171

176-
xit(name, fn) {
172+
void xit(name, fn) {
177173
_it(gns.xit, name, fn);
178174
}
179175

180176
class SpyFunction extends gns.SpyFunction {
181-
SpyFunction(name): super(name);
177+
SpyFunction(String name): super(name);
182178

183179
// TODO: vsavkin move to guinness
184180
andReturn(value) {

modules/angular2/src/test_lib/utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class Log {
99
this._result = [];
1010
}
1111

12-
add(value) {
12+
add(value):void {
1313
ListWrapper.push(this._result, value);
1414
}
1515

@@ -19,16 +19,16 @@ export class Log {
1919
}
2020
}
2121

22-
result() {
22+
result():string {
2323
return ListWrapper.join(this._result, "; ");
2424
}
2525
}
2626

27-
export function viewRootNodes(view) {
27+
export function viewRootNodes(view):List {
2828
return view.render.delegate.rootNodes;
2929
}
3030

31-
export function queryView(view, selector) {
31+
export function queryView(view, selector:string) {
3232
var rootNodes = viewRootNodes(view);
3333
for (var i = 0; i < rootNodes.length; ++i) {
3434
var res = DOM.querySelector(rootNodes[i], selector);
@@ -43,6 +43,6 @@ export function dispatchEvent(element, eventType) {
4343
DOM.dispatchEvent(element, DOM.createEvent(eventType));
4444
}
4545

46-
export function el(html) {
46+
export function el(html:string) {
4747
return DOM.firstChild(DOM.content(DOM.createTemplate(html)));
4848
}

0 commit comments

Comments
 (0)