-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(fetch): add selector Closes #4744 * feat: add overload without init parameter * refactor: use init and selector intersection * chore: add dtslint tests * docs: add chunked transfer encoding docs * chore: remove one space to appease the linter F*ck you, linter.
- Loading branch information
Showing
4 changed files
with
148 additions
and
7 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,18 @@ | ||
import { fromFetch } from 'rxjs/fetch'; | ||
import { a$ } from '../../helpers'; | ||
|
||
it('should emit the fetch Response by default', () => { | ||
const a = fromFetch("a"); // $ExpectType Observable<Response> | ||
}); | ||
|
||
it('should support a selector that returns a Response promise', () => { | ||
const a = fromFetch("a", { selector: response => response.text() }); // $ExpectType Observable<string> | ||
}); | ||
|
||
it('should support a selector that returns an arbitrary type', () => { | ||
const a = fromFetch("a", { selector: response => a$ }); // $ExpectType Observable<A> | ||
}); | ||
|
||
it('should error for selectors that don\'t return an ObservableInput', () => { | ||
const a = fromFetch("a", { selector: response => 42 }); // $ExpectError | ||
}); |
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
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
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