-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(rule): Add Observable.create fixture.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Observable } from "rxjs/Observable"; | ||
import "rxjs/add/operator/filter"; | ||
import "rxjs/add/operator/map"; | ||
|
||
// Note that Observable.create is declared as a Function: | ||
// https://github.com/ReactiveX/rxjs/blob/5.3.1/src/Observable.ts#L46-L58 | ||
// | ||
// So its result will be any - which will mess with the rules unless the | ||
// variable is explicitly typed: | ||
|
||
const ob1 = Observable.create((observer: Observer<number>) => { | ||
|
||
observer.next(1); | ||
observer.complete(); | ||
}); | ||
const ob2 = ob1.filter((value) => value > 1); | ||
|
||
|
||
const ob3 = ob1 as Observable<number>; | ||
const ob4 = ob3.map((value) => value + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"lib": ["es2015"], | ||
"noEmit": true, | ||
"paths": { | ||
"rxjs": ["../node_modules/rxjs"] | ||
}, | ||
"skipLibCheck": true, | ||
"target": "es5" | ||
}, | ||
"include": ["fixture.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters