mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-17 11:45:58 +08:00
Merge pull request #4292 from angular/typing_for_bind
Add typing for bind() which is also needed for demo
This commit is contained in:
@@ -2,9 +2,13 @@
|
||||
|
||||
// Use Typescript 1.4 style imports
|
||||
import ng = require("angular2/angular2");
|
||||
import di = require("angular2/di");
|
||||
|
||||
class Service {
|
||||
|
||||
}
|
||||
class Service2 {
|
||||
|
||||
}
|
||||
|
||||
class Cmp {
|
||||
@@ -13,7 +17,7 @@ class Cmp {
|
||||
Cmp.annotations = [
|
||||
ng.Component({
|
||||
selector: 'cmp',
|
||||
injectables: [Service]
|
||||
injectables: [Service, di.bind(Service2).toValue(null)]
|
||||
}),
|
||||
ng.View({
|
||||
template: '{{greeting}} world!',
|
||||
|
||||
19
angular2/angular2.d.ts
vendored
19
angular2/angular2.d.ts
vendored
@@ -602,4 +602,21 @@ declare module "angular2/angular2" {
|
||||
*
|
||||
*/
|
||||
function Switch(): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "angular2/di" {
|
||||
/**
|
||||
* Provides an API for imperatively constructing {@link Binding}s.
|
||||
*
|
||||
* This is only relevant for JavaScript. See {@link BindingBuilder}.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* ```javascript
|
||||
* bind(MyInterface).toClass(MyClass)
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
function bind(token: any): any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user