Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/rxjs.dev/tools/marbles/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ readdir(diagramsPath, (err, files) => {
Promise.all(files.map(fileName => renderMarble(diagramsPath, fileName)))
.then(_ => console.log('All SVGs created'))
.catch(e => console.error('generating SVGs failed', e));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
* unfiltered, thus it will get the link to
* /api/index/function/from
*/
module.exports = function filterFromInImports(): (words: string[], index: number) => boolean {
function filterFromInImports(): (words: string[], index: number) => boolean {
return (words: string[], index: number) => {
const previousWord = words[index - 1];
const nextWord = words[index + 1];

return words[index] === 'from' && /}/.test(previousWord) && /'/.test(nextWord);
};
};

export = filterFromInImports
3 changes: 2 additions & 1 deletion apps/rxjs.dev/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"outDir": "./out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"isolatedModules": true,
"noImplicitOverride": true,
// NOTE: Intentionally deviate from default Angular CLI settings
// (due to many violations and uglier syntax).
Expand Down Expand Up @@ -45,4 +46,4 @@
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
}
2 changes: 1 addition & 1 deletion packages/observable/src/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class Subscriber<T> extends Subscription implements Observer<T> {
}
}

unsubscribe(): void {
override unsubscribe(): void {
if (!this.closed) {
this.isStopped = true;
super.unsubscribe();
Expand Down
10 changes: 10 additions & 0 deletions packages/observable/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
"forceConsistentCasingInFileNames": true,
"inlineSources": true,
"jsx": "react",
"exactOptionalPropertyTypes": false,
"isolatedModules": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"noImplicitReturns": true,
"module": "nodenext",
"moduleResolution": "nodenext",
"noUncheckedIndexedAccess": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/rxjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"@types/chai": "^4.2.11",
"@types/lodash": "^4.14.198",
"@types/mocha": "^10.0.1",
"@types/node": "^14.14.6",
"@types/node": "^24.9.1",
"@types/shelljs": "^0.8.8",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/rxjs/spec/helpers/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**/

import * as chai from 'chai';
import * as sinonChai from 'sinon-chai';
import sinonChai from 'sinon-chai';

if (typeof Symbol !== 'function') {
let id = 0;
Expand Down
4 changes: 2 additions & 2 deletions packages/rxjs/spec/operators/groupBy-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,8 @@ describe('groupBy operator', () => {
// Just to get the test going.
expectObservable(result, unsub).toBe('-');
// Our two groups should error immediately upon subscription.
expectObservable(subjects.a).toBe('-');
expectObservable(subjects.b).toBe('-');
expectObservable(subjects['a']).toBe('-');
expectObservable(subjects['b']).toBe('-');
});
});

Expand Down
3 changes: 2 additions & 1 deletion packages/rxjs/spec/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../dist/spec",
"moduleResolution": "node10",
"module": "CommonJS"
},
"references": [
{
"path": "../src/tsconfig.types.spec.json"
}
]
}
}
6 changes: 3 additions & 3 deletions packages/rxjs/src/internal/AsyncSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AsyncSubject<T> extends Subject<T> {
private _isComplete = false;

/** @internal */
protected _checkFinalizedStatuses(subscriber: Subscriber<T>) {
protected override _checkFinalizedStatuses(subscriber: Subscriber<T>) {
const { hasError, _hasValue, _value, thrownError, _closed, _isComplete } = this;
if (hasError) {
subscriber.error(thrownError);
Expand All @@ -21,14 +21,14 @@ export class AsyncSubject<T> extends Subject<T> {
}
}

next(value: T): void {
override next(value: T): void {
if (!this._closed) {
this._value = value;
this._hasValue = true;
}
}

complete(): void {
override complete(): void {
const { _hasValue, _value, _isComplete } = this;
if (!_isComplete) {
this._isComplete = true;
Expand Down
4 changes: 2 additions & 2 deletions packages/rxjs/src/internal/BehaviorSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class BehaviorSubject<T> extends Subject<T> {
}

/** @internal */
protected _subscribe(subscriber: Subscriber<T>): Subscription {
protected override _subscribe(subscriber: Subscriber<T>): Subscription {
const subscription = super._subscribe(subscriber);
!subscription.closed && subscriber.next(this._value);
return subscription;
Expand All @@ -29,7 +29,7 @@ export class BehaviorSubject<T> extends Subject<T> {
return _value;
}

next(value: T): void {
override next(value: T): void {
super.next((this._value = value));
}
}
4 changes: 2 additions & 2 deletions packages/rxjs/src/internal/ReplaySubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ReplaySubject<T> extends Subject<T> {
this._windowTime = Math.max(1, _windowTime);
}

next(value: T): void {
override next(value: T): void {
const { _closed, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this;
if (!_closed) {
_buffer.push(value);
Expand All @@ -65,7 +65,7 @@ export class ReplaySubject<T> extends Subject<T> {
}

/** @internal */
protected _subscribe(subscriber: Subscriber<T>): Subscription {
protected override _subscribe(subscriber: Subscriber<T>): Subscription {
this._trimBuffer();

const subscription = this._innerSubscribe(subscriber);
Expand Down
2 changes: 1 addition & 1 deletion packages/rxjs/src/internal/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Subject<T> extends Observable<T> implements SubscriptionLike {
}

/** @internal */
protected _subscribe(subscriber: Subscriber<T>): Subscription {
protected override _subscribe(subscriber: Subscriber<T>): Subscription {
this._checkFinalizedStatuses(subscriber);
return this._innerSubscribe(subscriber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export class WebSocketSubject<In, Out = In> extends Observable<Out> {
}

/** @internal */
protected _subscribe(subscriber: Subscriber<Out>): Subscription {
protected override _subscribe(subscriber: Subscriber<Out>): Subscription {
if (!this._socket) {
this._connectSocket();
}
Expand Down
6 changes: 3 additions & 3 deletions packages/rxjs/src/internal/scheduler/AnimationFrameAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { animationFrameProvider } from './animationFrameProvider.js';
import type { TimerHandle } from './timerHandle.js';

export class AnimationFrameAction<T> extends AsyncAction<T> {
constructor(protected scheduler: AnimationFrameScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {
constructor(protected override scheduler: AnimationFrameScheduler, protected override work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);
}

protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
protected override requestAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay is greater than 0, request as an async action.
if (delay !== null && delay > 0) {
return super.requestAsyncId(scheduler, id, delay);
Expand All @@ -22,7 +22,7 @@ export class AnimationFrameAction<T> extends AsyncAction<T> {
return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(undefined)));
}

protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {
protected override recycleAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { AsyncAction } from './AsyncAction.js';
import { AsyncScheduler } from './AsyncScheduler.js';

export class AnimationFrameScheduler extends AsyncScheduler {
public flush(action?: AsyncAction<any>): void {
public override flush(action?: AsyncAction<any>): void {
this._active = true;
// The async id that effects a call to flush is stored in _scheduled.
// Before executing an action, it's necessary to check the action's async
Expand Down
6 changes: 3 additions & 3 deletions packages/rxjs/src/internal/scheduler/AsapAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { immediateProvider } from './immediateProvider.js';
import type { TimerHandle } from './timerHandle.js';

export class AsapAction<T> extends AsyncAction<T> {
constructor(protected scheduler: AsapScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {
constructor(protected override scheduler: AsapScheduler, protected override work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);
}

protected requestAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
protected override requestAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay is greater than 0, request as an async action.
if (delay !== null && delay > 0) {
return super.requestAsyncId(scheduler, id, delay);
Expand All @@ -22,7 +22,7 @@ export class AsapAction<T> extends AsyncAction<T> {
return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));
}

protected recycleAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {
protected override recycleAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
Expand Down
2 changes: 1 addition & 1 deletion packages/rxjs/src/internal/scheduler/AsapScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { AsyncAction } from './AsyncAction.js';
import { AsyncScheduler } from './AsyncScheduler.js';

export class AsapScheduler extends AsyncScheduler {
public flush(action?: AsyncAction<any>): void {
public override flush(action?: AsyncAction<any>): void {
this._active = true;
// The async id that effects a call to flush is stored in _scheduled.
// Before executing an action, it's necessary to check the action's async
Expand Down
4 changes: 2 additions & 2 deletions packages/rxjs/src/internal/scheduler/AsyncAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class AsyncAction<T> extends Action<T> {
super(scheduler, work);
}

public schedule(state?: T, delay: number = 0): Subscription {
public override schedule(state?: T, delay: number = 0): Subscription {
if (this.closed) {
return this;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ export class AsyncAction<T> extends Action<T> {
}
}

unsubscribe() {
override unsubscribe() {
if (!this.closed) {
const { id, scheduler } = this;
const { actions } = scheduler;
Expand Down
8 changes: 4 additions & 4 deletions packages/rxjs/src/internal/scheduler/QueueAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type { SchedulerAction } from '../types.js';
import type { TimerHandle } from './timerHandle.js';

export class QueueAction<T> extends AsyncAction<T> {
constructor(protected scheduler: QueueScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {
constructor(protected override scheduler: QueueScheduler, protected override work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);
}

public schedule(state?: T, delay: number = 0): Subscription {
public override schedule(state?: T, delay: number = 0): Subscription {
if (delay > 0) {
return super.schedule(state, delay);
}
Expand All @@ -19,11 +19,11 @@ export class QueueAction<T> extends AsyncAction<T> {
return this;
}

public execute(state: T, delay: number): any {
public override execute(state: T, delay: number): any {
return delay > 0 || this.closed ? super.execute(state, delay) : this._execute(state, delay);
}

protected requestAsyncId(scheduler: QueueScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
protected override requestAsyncId(scheduler: QueueScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
Expand Down
14 changes: 7 additions & 7 deletions packages/rxjs/src/internal/scheduler/VirtualTimeScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class VirtualTimeScheduler extends AsyncScheduler {
* Prompt the Scheduler to execute all of its queued actions, therefore
* clearing its queue.
*/
public flush(): void {
public override flush(): void {
const { actions, maxFrames } = this;
let error: any;
let action: AsyncAction<any> | undefined;
Expand All @@ -64,15 +64,15 @@ export class VirtualAction<T> extends AsyncAction<T> {
protected active: boolean = true;

constructor(
protected scheduler: VirtualTimeScheduler,
protected work: (this: SchedulerAction<T>, state?: T) => void,
protected override scheduler: VirtualTimeScheduler,
protected override work: (this: SchedulerAction<T>, state?: T) => void,
protected index: number = (scheduler.index += 1)
) {
super(scheduler, work);
this.index = scheduler.index = index;
}

public schedule(state?: T, delay: number = 0): Subscription {
public override schedule(state?: T, delay: number = 0): Subscription {
if (Number.isFinite(delay)) {
if (!this.id) {
return super.schedule(state, delay);
Expand All @@ -92,19 +92,19 @@ export class VirtualAction<T> extends AsyncAction<T> {
}
}

protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle {
protected override requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle {
this.delay = scheduler.frame + delay;
const { actions } = scheduler;
actions.push(this);
(actions as Array<VirtualAction<T>>).sort(VirtualAction.sortActions);
return 1;
}

protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle | undefined {
protected override recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle | undefined {
return undefined;
}

protected _execute(state: T, delay: number): any {
protected override _execute(state: T, delay: number): any {
if (this.active === true) {
return super._execute(state, delay);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rxjs/src/internal/testing/ColdObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ColdObservable<T> extends Observable<T> {
logSubscribedFrame = logSubscribedFrame;
logUnsubscribedFrame = logUnsubscribedFrame;

protected _subscribe(subscriber: Subscriber<any>): TeardownLogic {
protected override _subscribe(subscriber: Subscriber<any>): TeardownLogic {
const index = this.logSubscribedFrame();
const subscription = new Subscription();
subscription.add(
Expand Down
2 changes: 1 addition & 1 deletion packages/rxjs/src/internal/testing/HotObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class HotObservable<T> extends Subject<T> {
}

/** @internal */
protected _subscribe(subscriber: Subscriber<any>): Subscription {
protected override _subscribe(subscriber: Subscriber<any>): Subscription {
const index = this.logSubscribedFrame();
const subscription = new Subscription();
subscription.add(
Expand Down
4 changes: 2 additions & 2 deletions packages/rxjs/src/internal/testing/TestScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class TestScheduler extends VirtualTimeScheduler {
* the test scheduler is being used in "run mode", via the `run` method, this is temporarily
* set to `1` for the duration of the `run` block, then set back to whatever value it was.
*/
static frameTimeFactor = 10;
static override frameTimeFactor = 10;

/**
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
Expand Down Expand Up @@ -206,7 +206,7 @@ export class TestScheduler extends VirtualTimeScheduler {
};
}

flush() {
override flush() {
const hotObservables = this.hotObservables;
while (hotObservables.length > 0) {
hotObservables.shift()!.setup();
Expand Down
1 change: 0 additions & 1 deletion packages/rxjs/src/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"target": "ES2022",
"downlevelIteration": true,
"outDir": "../dist/cjs"
Expand Down
1 change: 1 addition & 0 deletions packages/rxjs/src/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node10",
"target": "ES2022",
"outDir": "../dist/esm"
}
Expand Down
Loading