Skip to content

Commit 2003e42

Browse files
committed
Merge pull request DefinitelyTyped#4292 from angular/typing_for_bind
Add typing for bind() which is also needed for demo
2 parents 05278a1 + 396000e commit 2003e42

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

angular2/angular2-tests.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
// Use Typescript 1.4 style imports
44
import ng = require("angular2/angular2");
5+
import di = require("angular2/di");
56

67
class Service {
78

9+
}
10+
class Service2 {
11+
812
}
913

1014
class Cmp {
@@ -13,7 +17,7 @@ class Cmp {
1317
Cmp.annotations = [
1418
ng.Component({
1519
selector: 'cmp',
16-
injectables: [Service]
20+
injectables: [Service, di.bind(Service2).toValue(null)]
1721
}),
1822
ng.View({
1923
template: '{{greeting}} world!',

angular2/angular2.d.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,4 +602,21 @@ declare module "angular2/angular2" {
602602
*
603603
*/
604604
function Switch(): void;
605-
}
605+
}
606+
607+
declare module "angular2/di" {
608+
/**
609+
* Provides an API for imperatively constructing {@link Binding}s.
610+
*
611+
* This is only relevant for JavaScript. See {@link BindingBuilder}.
612+
*
613+
* ## Example
614+
*
615+
* ```javascript
616+
* bind(MyInterface).toClass(MyClass)
617+
*
618+
* ```
619+
*
620+
*/
621+
function bind(token: any): any;
622+
}

0 commit comments

Comments
 (0)