Skip to content

Commit

Permalink
chore: fix TypeScript latest breakage in CI (#6503)
Browse files Browse the repository at this point in the history
* chore: appease TS in CI

global.gc seems to be possibly undefined in the latest Node types

* chore: appease TS

* chore: add optional shenanigans
  • Loading branch information
cartant authored Jul 5, 2021
1 parent 7ab0a4c commit 801a7bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions spec/Subscriber-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('Subscriber', () => {
});

const FinalizationRegistry = (global as any).FinalizationRegistry;
if (FinalizationRegistry) {
if (FinalizationRegistry && global.gc) {

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

observer = undefined;
global.gc();
global.gc?.();
});

} else {
Expand Down
4 changes: 2 additions & 2 deletions spec/operators/shareReplay-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ describe('shareReplay', () => {
});

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

callback = undefined;
global.gc();
global.gc?.();
});
} else {
console.warn(`No support for FinalizationRegistry in Node ${process.version}`);
Expand Down
4 changes: 2 additions & 2 deletions spec/schedulers/intervalProvider-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ describe('intervalProvider', () => {
let setCalled = false;
let clearCalled = false;

global.setInterval = () => {
global.setInterval = (() => {
setCalled = true;
return 0 as any;
};
}) as any; // TypeScript complains about a __promisify__ property
global.clearInterval = () => {
clearCalled = true;
};
Expand Down

0 comments on commit 801a7bb

Please sign in to comment.