Skip to content

Commit 801a7bb

Browse files
authored
chore: fix TypeScript latest breakage in CI (#6503)
* chore: appease TS in CI global.gc seems to be possibly undefined in the latest Node types * chore: appease TS * chore: add optional shenanigans
1 parent 7ab0a4c commit 801a7bb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

spec/Subscriber-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe('Subscriber', () => {
244244
});
245245

246246
const FinalizationRegistry = (global as any).FinalizationRegistry;
247-
if (FinalizationRegistry) {
247+
if (FinalizationRegistry && global.gc) {
248248

249249
it('should not leak the destination', (done) => {
250250
let observer: Observer<number> | undefined = {
@@ -262,7 +262,7 @@ describe('Subscriber', () => {
262262
const subscription = of(42).subscribe(observer);
263263

264264
observer = undefined;
265-
global.gc();
265+
global.gc?.();
266266
});
267267

268268
} else {

spec/operators/shareReplay-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ describe('shareReplay', () => {
366366
});
367367

368368
const FinalizationRegistry = (global as any).FinalizationRegistry;
369-
if (FinalizationRegistry) {
369+
if (FinalizationRegistry && global.gc) {
370370
it('should not leak the subscriber for sync sources', (done) => {
371371
let callback: (() => void) | undefined = () => {
372372
/* noop */
@@ -382,7 +382,7 @@ describe('shareReplay', () => {
382382
shared.subscribe(callback);
383383

384384
callback = undefined;
385-
global.gc();
385+
global.gc?.();
386386
});
387387
} else {
388388
console.warn(`No support for FinalizationRegistry in Node ${process.version}`);

spec/schedulers/intervalProvider-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ describe('intervalProvider', () => {
1515
let setCalled = false;
1616
let clearCalled = false;
1717

18-
global.setInterval = () => {
18+
global.setInterval = (() => {
1919
setCalled = true;
2020
return 0 as any;
21-
};
21+
}) as any; // TypeScript complains about a __promisify__ property
2222
global.clearInterval = () => {
2323
clearCalled = true;
2424
};

0 commit comments

Comments
 (0)