From 1d72fca2f71bd52471a5b46f981be1916323af8b Mon Sep 17 00:00:00 2001 From: Tom Andersen Date: Mon, 25 Sep 2023 21:32:13 -0400 Subject: [PATCH] chore: Make compile with NodeJS v20.5.0 (#1906) An external change to CI appears to run code on NodeJS v20.5.0. Unfortunately, this breaks our hacky override of Timeout. So as a quick fix, I made it even hackier. Since we only use this for tests, this should be fine. --- dev/src/backoff.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/src/backoff.ts b/dev/src/backoff.ts index 4ec81c91b..9a7ca9053 100644 --- a/dev/src/backoff.ts +++ b/dev/src/backoff.ts @@ -92,7 +92,12 @@ export function setTimeoutHandler( [Symbol.toPrimitive]: () => { throw new Error('For tests only. Not Implemented'); }, - }; + } as unknown as NodeJS.Timeout; + // `NodeJS.Timeout` type signature change: + // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66176/files#diff-e838d0ace9cd5f6516bacfbd3ad00d02cd37bd60f9993ce6223f52d889a1fdbaR122-R126 + // + // Adding `[Symbol.dispose](): void;` cannot be done on older versions of + // NodeJS. So we simply cast to `NodeJS.Timeout`. return timeout; }; }