Skip to content

Commit 5cda1a3

Browse files
committed
Added typescript definition file
1 parent a3e162e commit 5cda1a3

File tree

4 files changed

+62
-2
lines changed

4 files changed

+62
-2
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"grunt-contrib-qunit": "*",
3030
"grunt-contrib-uglify": "*",
3131
"grunt-ng-annotate": "^0.10.0",
32-
"load-grunt-tasks": "*"
32+
"load-grunt-tasks": "*",
33+
"tsd": "^0.6.5"
3334
},
3435
"jam": {
3536
"main": "dist/rx.angular.js"
@@ -44,6 +45,7 @@
4445
],
4546
"main": "index.js",
4647
"scripts": {
47-
"test": "grunt"
48+
"test": "grunt",
49+
"postinstall": "node node_modules/tsd/build/cli.js install"
4850
}
4951
}

ts/rx.angular.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Created by Giles Roadnight on 26/01/2016.
3+
*/
4+
5+
///<reference path="../typings/tsd.d.ts" />
6+
7+
declare module Rx {
8+
9+
export interface Observable<T> {
10+
safeApply( scope: ng.IScope, onNext?: (value: T) => void, onError?: (error: any) => void, onComplete?: () => void ): Observable<T>;
11+
12+
digest( scope: ng.IScope, prop: string ): Observable<T>;
13+
}
14+
}
15+
16+
declare module angular{
17+
18+
export interface IObservableChange<T>{
19+
observable: Rx.Observable<T>;
20+
expression: string;
21+
value: T;
22+
}
23+
24+
export interface IScope{
25+
$createObservableFunction<T>( functionName: string, listener: (data) => void ): Rx.Observable<T>;
26+
$digestObservables<T>( observables: {[key:string]:Rx.Observable<T>} ): Rx.Observable<IObservableChange<T>>;
27+
$eventToObservable<T>(eventName: string): Rx.Observable<T>;
28+
$toObservable<T>(watchExpression: (scope: ng.IScope) => void | string, objectEquality?:boolean ): Rx.Observable<T>;
29+
}
30+
}

ts/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"sourceMap": false,
6+
"diagnostics": true
7+
},
8+
"files": [
9+
"rx.angular.d.ts"
10+
],
11+
"exclude": [
12+
]
13+
}

tsd.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "v4",
3+
"repo": "borisyankov/DefinitelyTyped",
4+
"ref": "master",
5+
"path": "typings",
6+
"bundle": "typings/tsd.d.ts",
7+
"installed": {
8+
"angularjs/angular.d.ts": {
9+
"commit": "46719185c564694c5583c4b7ad94dbb786ecad46"
10+
},
11+
"jquery/jquery.d.ts": {
12+
"commit": "46719185c564694c5583c4b7ad94dbb786ecad46"
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)