Enable tsconfig noUncheckedIndexedAccess

This commit is contained in:
Jamie
2026-03-12 16:24:01 -07:00
committed by GitHub
parent 34b0f9cd50
commit 1d45a52da7
311 changed files with 2146 additions and 1589 deletions

View File

@@ -137,6 +137,7 @@ export async function happyEyeballs({
const results = await Promise.allSettled(
interleaved.map(async (addr, index) => {
const abortController = abortControllers[index];
strictAssert(abortController, 'Missing abortController');
if (index !== 0) {
await sleep(index * DELAY_MS, abortController.signal);
}
@@ -185,17 +186,22 @@ export async function happyEyeballs({
'Fulfilled promise was not fulfilled'
);
const { socket, index } = fulfilled.value;
const address = interleaved[index];
strictAssert(address, 'Missing address');
return {
socket,
address: interleaved[index],
address,
v4Attempts,
v6Attempts,
};
}
const firstResult = results[0];
strictAssert(firstResult, 'Missing firstResult');
strictAssert(
results[0].status === 'rejected',
firstResult.status === 'rejected',
'No fulfilled promises, but no rejected either'
);
@@ -203,7 +209,7 @@ export async function happyEyeballs({
for (const controller of abortControllers) {
controller.abort();
}
throw results[0].reason;
throw firstResult.reason;
}
export type ConnectOptionsType = Readonly<{