igorbek / rx.d.ts Goto Github PK
View Code? Open in Web Editor NEWRxJS TypeScript Definitions
RxJS TypeScript Definitions
The current typing for Notification<T>.accept
in rx-lite.d.ts reads:
accept(observer: IObserver<T>): void;
But the implementation in notification.js always returns an Observable<T>
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
}
The current typings for ObserverStatic. fromNotifier
reads:
fromNotifier<T>(handler: (notification: Notification<T>, thisArg?: any) => void): Observer<T>;
The correct typings are:
fromNotifier<T>(handler: (notification: Notification<T>) => void, thisArg?: any): Observer<T>;
See observer-lite.js:
Observer.fromNotifier = function (handler, thisArg) {
Hello Igor,
please change class Scheduler
to interface Scheduler
as follows:
export interface Scheduler extends IScheduler {
now(): number;
catch(handler: (exception: any) => boolean): IScheduler;
catchException(handler: (exception: any) => boolean): IScheduler;
schedule(action: () => void): IDisposable;
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
scheduleWithAbsolute(dueTime: number, action: () => void): IDisposable;
scheduleWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
scheduleRecursive(action: (action: () => void) => void): IDisposable;
scheduleRecursiveWithState<TState>(state: TState, action: (state: TState, action: (state: TState) => void) => void): IDisposable;
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
scheduleRecursiveWithRelativeAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
schedulePeriodic(period: number, action: () => void): IDisposable;
schedulePeriodicWithState<TState>(state: TState, period: number, action: (state: TState) => TState): IDisposable;
}
interface SchedulerStatic {
new (now: () => number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Scheduler;
normalize(timeSpan: number): number;
immediate: IScheduler;
currentThread: ICurrentThreadScheduler;
timeout: IScheduler;
}
export var Scheduler: SchedulerStatic;
That would be analog to Subject
and other classes in rx-lite.d.ts
.
By doing so you would allow RxJS-DOM
extensions like Scheduler.requestanimationframe to hook into Scheduler
's static api:
declare module Rx
{
export interface SchedulerStatic
{
requestAnimationFrame: IScheduler;
}
}
...
Rx.Scheduler.requestAnimationFrame.schedule( function(): void {
...
});
I can also send you a pull request if you grant me push rights.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.