mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 21:24:48 +00:00
fix: Better use of @ts-expect-error (#6038)
This commit is contained in:
parent
8b1b4766a1
commit
3fe6bc1b82
24 changed files with 152 additions and 145 deletions
|
@ -214,7 +214,13 @@ function evaluateCallSite(callSite: CallSite): CallSiteEval {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareStackTrace(error: Error, callSites: CallSite[]): string {
|
function prepareStackTrace(
|
||||||
|
error: Error & {
|
||||||
|
__callSiteEvals: CallSiteEval[];
|
||||||
|
__formattedFrames: string[];
|
||||||
|
},
|
||||||
|
callSites: CallSite[]
|
||||||
|
): string {
|
||||||
const mappedCallSites = callSites.map(
|
const mappedCallSites = callSites.map(
|
||||||
(callSite): CallSite => {
|
(callSite): CallSite => {
|
||||||
const fileName = callSite.getFileName();
|
const fileName = callSite.getFileName();
|
||||||
|
@ -238,19 +244,14 @@ function prepareStackTrace(error: Error, callSites: CallSite[]): string {
|
||||||
__formattedFrames: { value: [], configurable: true },
|
__formattedFrames: { value: [], configurable: true },
|
||||||
});
|
});
|
||||||
for (const callSite of mappedCallSites) {
|
for (const callSite of mappedCallSites) {
|
||||||
// @ts-expect-error
|
|
||||||
error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite)));
|
error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite)));
|
||||||
const isInternal = callSite.getFileName()?.startsWith("$deno$") ?? false;
|
const isInternal = callSite.getFileName()?.startsWith("$deno$") ?? false;
|
||||||
// @ts-expect-error
|
|
||||||
error.__formattedFrames.push(callSiteToString(callSite, isInternal));
|
error.__formattedFrames.push(callSiteToString(callSite, isInternal));
|
||||||
}
|
}
|
||||||
// @ts-expect-error
|
|
||||||
Object.freeze(error.__callSiteEvals);
|
Object.freeze(error.__callSiteEvals);
|
||||||
// @ts-expect-error
|
|
||||||
Object.freeze(error.__formattedFrames);
|
Object.freeze(error.__formattedFrames);
|
||||||
return (
|
return (
|
||||||
`${error.name}: ${error.message}\n` +
|
`${error.name}: ${error.message}\n` +
|
||||||
// @ts-expect-error
|
|
||||||
error.__formattedFrames
|
error.__formattedFrames
|
||||||
.map((s: string) => ` at ${colors.stripColor(s)}`)
|
.map((s: string) => ` at ${colors.stripColor(s)}`)
|
||||||
.join("\n")
|
.join("\n")
|
||||||
|
|
|
@ -35,8 +35,8 @@ function isRecoverableError(e: Error): boolean {
|
||||||
// Returns `true` if `close()` is called in REPL.
|
// Returns `true` if `close()` is called in REPL.
|
||||||
// We should quit the REPL when this function returns `true`.
|
// We should quit the REPL when this function returns `true`.
|
||||||
function isCloseCalled(): boolean {
|
function isCloseCalled(): boolean {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
return globalThis.closed;
|
return (globalThis as any).closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
|
|
@ -30,8 +30,8 @@ import { log, immutableDefine } from "./util.ts";
|
||||||
// TODO: factor out `Deno` global assignment to separate function
|
// TODO: factor out `Deno` global assignment to separate function
|
||||||
// Add internal object to Deno object.
|
// Add internal object to Deno object.
|
||||||
// This is not exposed as part of the Deno types.
|
// This is not exposed as part of the Deno types.
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
denoNs[internalSymbol] = internalObject;
|
(denoNs as any)[internalSymbol] = internalObject;
|
||||||
|
|
||||||
let windowIsClosing = false;
|
let windowIsClosing = false;
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ export function bootstrapMainRuntime(): void {
|
||||||
throw new Error("Worker runtime already bootstrapped");
|
throw new Error("Worker runtime already bootstrapped");
|
||||||
}
|
}
|
||||||
// Remove bootstrapping methods from global scope
|
// Remove bootstrapping methods from global scope
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
globalThis.bootstrap = undefined;
|
(globalThis as any).bootstrap = undefined;
|
||||||
log("bootstrapMainRuntime");
|
log("bootstrapMainRuntime");
|
||||||
hasBootstrapped = true;
|
hasBootstrapped = true;
|
||||||
Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods);
|
Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods);
|
||||||
|
|
|
@ -33,8 +33,8 @@ import { setSignals } from "./signals.ts";
|
||||||
// TODO: factor out `Deno` global assignment to separate function
|
// TODO: factor out `Deno` global assignment to separate function
|
||||||
// Add internal object to Deno object.
|
// Add internal object to Deno object.
|
||||||
// This is not exposed as part of the Deno types.
|
// This is not exposed as part of the Deno types.
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
denoNs[internalSymbol] = internalObject;
|
(denoNs as any)[internalSymbol] = internalObject;
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
||||||
|
@ -128,8 +128,8 @@ export function bootstrapWorkerRuntime(
|
||||||
throw new Error("Worker runtime already bootstrapped");
|
throw new Error("Worker runtime already bootstrapped");
|
||||||
}
|
}
|
||||||
// Remove bootstrapping methods from global scope
|
// Remove bootstrapping methods from global scope
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
globalThis.bootstrap = undefined;
|
(globalThis as any).bootstrap = undefined;
|
||||||
log("bootstrapWorkerRuntime");
|
log("bootstrapWorkerRuntime");
|
||||||
hasBootstrapped = true;
|
hasBootstrapped = true;
|
||||||
Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods);
|
Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods);
|
||||||
|
|
|
@ -336,8 +336,8 @@ async function runTests({
|
||||||
const originalConsole = globalThis.console;
|
const originalConsole = globalThis.console;
|
||||||
|
|
||||||
if (disableLog) {
|
if (disableLog) {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
globalThis.console = disabledConsole;
|
(globalThis as any).console = disabledConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
let endMsg: TestMessage["end"];
|
let endMsg: TestMessage["end"];
|
||||||
|
|
|
@ -216,14 +216,18 @@ function groupEntries<T>(
|
||||||
lineMaxLength += separatorSpace;
|
lineMaxLength += separatorSpace;
|
||||||
maxLineLength[i] = lineMaxLength;
|
maxLineLength[i] = lineMaxLength;
|
||||||
}
|
}
|
||||||
let order = "padStart";
|
let order: "padStart" | "padEnd" = "padStart";
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
for (let i = 0; i < entries.length; i++) {
|
for (let i = 0; i < entries.length; i++) {
|
||||||
//@ts-expect-error
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
if (typeof value[i] !== "number" && typeof value[i] !== "bigint") {
|
if (
|
||||||
|
typeof (value as any)[i] !== "number" &&
|
||||||
|
typeof (value as any)[i] !== "bigint"
|
||||||
|
) {
|
||||||
order = "padEnd";
|
order = "padEnd";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Each iteration creates a single line of grouped entries.
|
// Each iteration creates a single line of grouped entries.
|
||||||
|
@ -235,7 +239,6 @@ function groupEntries<T>(
|
||||||
for (; j < max - 1; j++) {
|
for (; j < max - 1; j++) {
|
||||||
// In future, colors should be taken here into the account
|
// In future, colors should be taken here into the account
|
||||||
const padding = maxLineLength[j - i];
|
const padding = maxLineLength[j - i];
|
||||||
//@ts-expect-error
|
|
||||||
str += `${entries[j]}, `[order](padding, " ");
|
str += `${entries[j]}, `[order](padding, " ");
|
||||||
}
|
}
|
||||||
if (order === "padStart") {
|
if (order === "padStart") {
|
||||||
|
@ -408,8 +411,8 @@ function createMapString(
|
||||||
},
|
},
|
||||||
group: false,
|
group: false,
|
||||||
};
|
};
|
||||||
//@ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
return createIterableString(value, ctx, level, maxLevel, printConfig);
|
return createIterableString(value as any, ctx, level, maxLevel, printConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWeakSetString(): string {
|
function createWeakSetString(): string {
|
||||||
|
@ -477,7 +480,7 @@ function createPromiseString(
|
||||||
// TODO: Proxy
|
// TODO: Proxy
|
||||||
|
|
||||||
function createRawObjectString(
|
function createRawObjectString(
|
||||||
value: { [key: string]: unknown },
|
value: Record<string, unknown>,
|
||||||
ctx: ConsoleContext,
|
ctx: ConsoleContext,
|
||||||
level: number,
|
level: number,
|
||||||
maxLevel: number
|
maxLevel: number
|
||||||
|
@ -490,8 +493,9 @@ function createRawObjectString(
|
||||||
let baseString = "";
|
let baseString = "";
|
||||||
|
|
||||||
let shouldShowDisplayName = false;
|
let shouldShowDisplayName = false;
|
||||||
// @ts-expect-error
|
let displayName = (value as { [Symbol.toStringTag]: string })[
|
||||||
let displayName = value[Symbol.toStringTag];
|
Symbol.toStringTag
|
||||||
|
];
|
||||||
if (!displayName) {
|
if (!displayName) {
|
||||||
displayName = getClassInstanceName(value);
|
displayName = getClassInstanceName(value);
|
||||||
}
|
}
|
||||||
|
@ -511,8 +515,8 @@ function createRawObjectString(
|
||||||
for (const key of symbolKeys) {
|
for (const key of symbolKeys) {
|
||||||
entries.push(
|
entries.push(
|
||||||
`${key.toString()}: ${stringifyWithQuotes(
|
`${key.toString()}: ${stringifyWithQuotes(
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
value[key],
|
value[key as any],
|
||||||
ctx,
|
ctx,
|
||||||
level + 1,
|
level + 1,
|
||||||
maxLevel
|
maxLevel
|
||||||
|
|
|
@ -187,7 +187,7 @@ function sendFetchReq(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetch(
|
export async function fetch(
|
||||||
input: domTypes.Request | URL | string,
|
input: (domTypes.Request & { _bodySource?: unknown }) | URL | string,
|
||||||
init?: domTypes.RequestInit
|
init?: domTypes.RequestInit
|
||||||
): Promise<Response> {
|
): Promise<Response> {
|
||||||
let url: string;
|
let url: string;
|
||||||
|
@ -285,7 +285,6 @@ export async function fetch(
|
||||||
method = input.method;
|
method = input.method;
|
||||||
headers = input.headers;
|
headers = input.headers;
|
||||||
|
|
||||||
//@ts-expect-error
|
|
||||||
if (input._bodySource) {
|
if (input._bodySource) {
|
||||||
body = new DataView(await input.arrayBuffer());
|
body = new DataView(await input.arrayBuffer());
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,23 +234,23 @@ function setTimer(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setTimeout(
|
export function setTimeout(
|
||||||
|
this: unknown,
|
||||||
cb: (...args: Args) => void,
|
cb: (...args: Args) => void,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
...args: Args
|
...args: Args
|
||||||
): number {
|
): number {
|
||||||
checkBigInt(delay);
|
checkBigInt(delay);
|
||||||
// @ts-expect-error
|
|
||||||
checkThis(this);
|
checkThis(this);
|
||||||
return setTimer(cb, delay, args, false);
|
return setTimer(cb, delay, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setInterval(
|
export function setInterval(
|
||||||
|
this: unknown,
|
||||||
cb: (...args: Args) => void,
|
cb: (...args: Args) => void,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
...args: Args
|
...args: Args
|
||||||
): number {
|
): number {
|
||||||
checkBigInt(delay);
|
checkBigInt(delay);
|
||||||
// @ts-expect-error
|
|
||||||
checkThis(this);
|
checkThis(this);
|
||||||
return setTimer(cb, delay, args, true);
|
return setTimer(cb, delay, args, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ unitTest(
|
||||||
|
|
||||||
const body = buildBody(text);
|
const body = buildBody(text);
|
||||||
|
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
body.contentType = "multipart/form-data;boundary=boundary";
|
(body as any).contentType = "multipart/form-data;boundary=boundary";
|
||||||
|
|
||||||
const formData = await body.formData();
|
const formData = await body.formData();
|
||||||
assert(formData.has("field_1"));
|
assert(formData.has("field_1"));
|
||||||
|
@ -62,8 +62,8 @@ unitTest(
|
||||||
|
|
||||||
const body = buildBody(text);
|
const body = buildBody(text);
|
||||||
|
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
body.contentType = "application/x-www-form-urlencoded";
|
(body as any).contentType = "application/x-www-form-urlencoded";
|
||||||
|
|
||||||
const formData = await body.formData();
|
const formData = await body.formData();
|
||||||
assert(formData.has("field_1"));
|
assert(formData.has("field_1"));
|
||||||
|
|
|
@ -19,14 +19,19 @@ unitTest(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
|
||||||
|
declare global {
|
||||||
|
namespace Deno {
|
||||||
|
var core: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
unitTest(function malformedJsonControlBuffer(): void {
|
unitTest(function malformedJsonControlBuffer(): void {
|
||||||
// @ts-expect-error
|
|
||||||
const opId = Deno.core.ops()["op_open"];
|
const opId = Deno.core.ops()["op_open"];
|
||||||
// @ts-expect-error
|
|
||||||
const res = Deno.core.send(opId, new Uint8Array([1, 2, 3, 4, 5]));
|
const res = Deno.core.send(opId, new Uint8Array([1, 2, 3, 4, 5]));
|
||||||
const resText = new TextDecoder().decode(res);
|
const resText = new TextDecoder().decode(res);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
const resJson = JSON.parse(resText);
|
||||||
const resJson = JSON.parse(resText) as any;
|
|
||||||
assert(!resJson.ok);
|
assert(!resJson.ok);
|
||||||
assert(resJson.err);
|
assert(resJson.err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,10 +25,16 @@ unitTest(async function sendAsyncStackTrace(): Promise<void> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
|
||||||
|
declare global {
|
||||||
|
namespace Deno {
|
||||||
|
var core: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
unitTest(function malformedMinimalControlBuffer(): void {
|
unitTest(function malformedMinimalControlBuffer(): void {
|
||||||
// @ts-expect-error
|
|
||||||
const readOpId = Deno.core.ops()["op_read"];
|
const readOpId = Deno.core.ops()["op_read"];
|
||||||
// @ts-expect-error
|
|
||||||
const res = Deno.core.send(readOpId, new Uint8Array([1, 2, 3, 4, 5]));
|
const res = Deno.core.send(readOpId, new Uint8Array([1, 2, 3, 4, 5]));
|
||||||
const header = res.slice(0, 12);
|
const header = res.slice(0, 12);
|
||||||
const buf32 = new Int32Array(
|
const buf32 = new Int32Array(
|
||||||
|
|
|
@ -92,9 +92,8 @@ unitTest({ perms: { net: true } }, async function fetchBodyUsed(): Promise<
|
||||||
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
|
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
|
||||||
assertEquals(response.bodyUsed, false);
|
assertEquals(response.bodyUsed, false);
|
||||||
assertThrows((): void => {
|
assertThrows((): void => {
|
||||||
// Assigning to read-only property throws in the strict mode.
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
// @ts-expect-error
|
(response as any).bodyUsed = true;
|
||||||
response.bodyUsed = true;
|
|
||||||
});
|
});
|
||||||
await response.blob();
|
await response.blob();
|
||||||
assertEquals(response.bodyUsed, true);
|
assertEquals(response.bodyUsed, true);
|
||||||
|
@ -657,10 +656,9 @@ unitTest({ perms: { net: true } }, async function fetchBodyReadTwice(): Promise<
|
||||||
assert(_json);
|
assert(_json);
|
||||||
|
|
||||||
// All calls after the body was consumed, should fail
|
// All calls after the body was consumed, should fail
|
||||||
const methods = ["json", "text", "formData", "arrayBuffer"];
|
const methods = ["json", "text", "formData", "arrayBuffer"] as const;
|
||||||
for (const method of methods) {
|
for (const method of methods) {
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
|
||||||
await response[method]();
|
await response[method]();
|
||||||
fail(
|
fail(
|
||||||
"Reading body multiple times should failed, the stream should've been locked."
|
"Reading body multiple times should failed, the stream should've been locked."
|
||||||
|
|
|
@ -290,8 +290,8 @@ unitTest(
|
||||||
// writing null should throw an error
|
// writing null should throw an error
|
||||||
let err;
|
let err;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
await file.write(null);
|
await file.write(null as any);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = e;
|
err = e;
|
||||||
}
|
}
|
||||||
|
@ -322,8 +322,8 @@ unitTest(
|
||||||
// reading file into null buffer should throw an error
|
// reading file into null buffer should throw an error
|
||||||
let err;
|
let err;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
await file.read(null);
|
await file.read(null as any);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = e;
|
err = e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,10 @@ unitTest(function formDataParamsGetSuccess(): void {
|
||||||
formData.append("a", "true");
|
formData.append("a", "true");
|
||||||
formData.append("b", "false");
|
formData.append("b", "false");
|
||||||
formData.append("a", "null");
|
formData.append("a", "null");
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData.append("d", undefined);
|
formData.append("d", undefined as any);
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData.append("e", null);
|
formData.append("e", null as any);
|
||||||
assertEquals(formData.get("a"), "true");
|
assertEquals(formData.get("a"), "true");
|
||||||
assertEquals(formData.get("b"), "false");
|
assertEquals(formData.get("b"), "false");
|
||||||
assertEquals(formData.get("c"), null);
|
assertEquals(formData.get("c"), null);
|
||||||
|
@ -70,11 +70,11 @@ unitTest(function formDataParamsSetSuccess(): void {
|
||||||
assertEquals(formData.getAll("b"), ["false"]);
|
assertEquals(formData.getAll("b"), ["false"]);
|
||||||
formData.set("a", "false");
|
formData.set("a", "false");
|
||||||
assertEquals(formData.getAll("a"), ["false"]);
|
assertEquals(formData.getAll("a"), ["false"]);
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData.set("d", undefined);
|
formData.set("d", undefined as any);
|
||||||
assertEquals(formData.get("d"), "undefined");
|
assertEquals(formData.get("d"), "undefined");
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData.set("e", null);
|
formData.set("e", null as any);
|
||||||
assertEquals(formData.get("e"), "null");
|
assertEquals(formData.get("e"), "null");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -143,8 +143,8 @@ unitTest(function formDataParamsArgumentsCheck(): void {
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData[method]();
|
(formData as any)[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errMsg = err.message;
|
errMsg = err.message;
|
||||||
|
@ -167,8 +167,8 @@ unitTest(function formDataParamsArgumentsCheck(): void {
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData[method]();
|
(formData as any)[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errMsg = err.message;
|
errMsg = err.message;
|
||||||
|
@ -187,8 +187,8 @@ unitTest(function formDataParamsArgumentsCheck(): void {
|
||||||
hasThrown = 0;
|
hasThrown = 0;
|
||||||
errMsg = "";
|
errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
formData[method]("foo");
|
(formData as any)[method]("foo");
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errMsg = err.message;
|
errMsg = err.message;
|
||||||
|
|
|
@ -45,16 +45,24 @@ unitTest(function webAssemblyExists(): void {
|
||||||
assert(typeof WebAssembly.compile === "function");
|
assert(typeof WebAssembly.compile === "function");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
|
||||||
|
declare global {
|
||||||
|
namespace Deno {
|
||||||
|
var core: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
unitTest(function DenoNamespaceImmutable(): void {
|
unitTest(function DenoNamespaceImmutable(): void {
|
||||||
const denoCopy = window.Deno;
|
const denoCopy = window.Deno;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
Deno = 1;
|
(Deno as any) = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(denoCopy === Deno);
|
assert(denoCopy === Deno);
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
window.Deno = 1;
|
(window as any).Deno = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(denoCopy === Deno);
|
assert(denoCopy === Deno);
|
||||||
try {
|
try {
|
||||||
|
@ -64,8 +72,8 @@ unitTest(function DenoNamespaceImmutable(): void {
|
||||||
|
|
||||||
const { readFile } = Deno;
|
const { readFile } = Deno;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
Deno.readFile = 1;
|
(Deno as any).readFile = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(readFile === Deno.readFile);
|
assert(readFile === Deno.readFile);
|
||||||
try {
|
try {
|
||||||
|
@ -73,19 +81,14 @@ unitTest(function DenoNamespaceImmutable(): void {
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(readFile === Deno.readFile);
|
assert(readFile === Deno.readFile);
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
const { print } = Deno.core;
|
const { print } = Deno.core;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
|
||||||
Deno.core.print = 1;
|
Deno.core.print = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
// @ts-expect-error
|
|
||||||
assert(print === Deno.core.print);
|
assert(print === Deno.core.print);
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
|
||||||
delete Deno.core.print;
|
delete Deno.core.print;
|
||||||
} catch {}
|
} catch {}
|
||||||
// @ts-expect-error
|
|
||||||
assert(print === Deno.core.print);
|
assert(print === Deno.core.print);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ unitTest(function newHeaderTest(): void {
|
||||||
new Headers(undefined);
|
new Headers(undefined);
|
||||||
new Headers({});
|
new Headers({});
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
new Headers(null);
|
new Headers(null as any);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
e.message,
|
e.message,
|
||||||
|
@ -36,8 +36,8 @@ const headerDict: Record<string, string> = {
|
||||||
name1: "value1",
|
name1: "value1",
|
||||||
name2: "value2",
|
name2: "value2",
|
||||||
name3: "value3",
|
name3: "value3",
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
name4: undefined,
|
name4: undefined as any,
|
||||||
"Content-Type": "value4",
|
"Content-Type": "value4",
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
@ -264,17 +264,17 @@ unitTest(function headerParamsShouldThrowTypeError(): void {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(function headerParamsArgumentsCheck(): void {
|
unitTest(function headerParamsArgumentsCheck(): void {
|
||||||
const methodRequireOneParam = ["delete", "get", "has", "forEach"];
|
const methodRequireOneParam = ["delete", "get", "has", "forEach"] as const;
|
||||||
|
|
||||||
const methodRequireTwoParams = ["append", "set"];
|
const methodRequireTwoParams = ["append", "set"] as const;
|
||||||
|
|
||||||
methodRequireOneParam.forEach((method): void => {
|
methodRequireOneParam.forEach((method): void => {
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
headers[method]();
|
(headers as any)[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errMsg = err.message;
|
errMsg = err.message;
|
||||||
|
@ -297,8 +297,8 @@ unitTest(function headerParamsArgumentsCheck(): void {
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
headers[method]();
|
(headers as any)[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errMsg = err.message;
|
errMsg = err.message;
|
||||||
|
@ -317,8 +317,8 @@ unitTest(function headerParamsArgumentsCheck(): void {
|
||||||
hasThrown = 0;
|
hasThrown = 0;
|
||||||
errMsg = "";
|
errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
headers[method]("foo");
|
(headers as any)[method]("foo");
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errMsg = err.message;
|
errMsg = err.message;
|
||||||
|
|
|
@ -10,22 +10,22 @@ unitTest(function fromInit(): void {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
assertEquals("ahoyhoy", req._bodySource);
|
assertEquals("ahoyhoy", (req as any)._bodySource);
|
||||||
assertEquals(req.url, "https://example.com");
|
assertEquals(req.url, "https://example.com");
|
||||||
assertEquals(req.headers.get("test-header"), "value");
|
assertEquals(req.headers.get("test-header"), "value");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(function fromRequest(): void {
|
unitTest(function fromRequest(): void {
|
||||||
const r = new Request("https://example.com");
|
const r = new Request("https://example.com");
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
r._bodySource = "ahoyhoy";
|
(r as any)._bodySource = "ahoyhoy";
|
||||||
r.headers.set("test-header", "value");
|
r.headers.set("test-header", "value");
|
||||||
|
|
||||||
const req = new Request(r);
|
const req = new Request(r);
|
||||||
|
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
assertEquals(req._bodySource, r._bodySource);
|
assertEquals((req as any)._bodySource, (r as any)._bodySource);
|
||||||
assertEquals(req.url, r.url);
|
assertEquals(req.url, r.url);
|
||||||
assertEquals(req.headers.get("test-header"), r.headers.get("test-header"));
|
assertEquals(req.headers.get("test-header"), r.headers.get("test-header"));
|
||||||
});
|
});
|
||||||
|
@ -44,6 +44,6 @@ unitTest(async function cloneRequestBodyStream(): Promise<void> {
|
||||||
|
|
||||||
assertEquals(b1, b2);
|
assertEquals(b1, b2);
|
||||||
|
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
assert(r1._bodySource !== r2._bodySource);
|
assert((r1 as any)._bodySource !== (r2 as any)._bodySource);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,15 +2,12 @@
|
||||||
import { unitTest, assertThrows } from "./test_util.ts";
|
import { unitTest, assertThrows } from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(function streamReadableHwmError() {
|
unitTest(function streamReadableHwmError() {
|
||||||
const invalidHwm = [NaN, Number("NaN"), {}, -1, "two"];
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const invalidHwm: any[] = [NaN, Number("NaN"), {}, -1, "two"];
|
||||||
for (const highWaterMark of invalidHwm) {
|
for (const highWaterMark of invalidHwm) {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
new ReadableStream<number>(
|
new ReadableStream<number>(undefined, { highWaterMark });
|
||||||
undefined,
|
|
||||||
// @ts-expect-error
|
|
||||||
{ highWaterMark }
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
RangeError,
|
RangeError,
|
||||||
"highWaterMark must be a positive number or Infinity. Received:"
|
"highWaterMark must be a positive number or Infinity. Received:"
|
||||||
|
@ -20,20 +17,20 @@ unitTest(function streamReadableHwmError() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
new ReadableStream<number>(
|
new ReadableStream<number>(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
{ highWaterMark: Symbol("hwk") }
|
{ highWaterMark: Symbol("hwk") as any }
|
||||||
);
|
);
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(function streamWriteableHwmError() {
|
unitTest(function streamWriteableHwmError() {
|
||||||
const invalidHwm = [NaN, Number("NaN"), {}, -1, "two"];
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const invalidHwm: any[] = [NaN, Number("NaN"), {}, -1, "two"];
|
||||||
for (const highWaterMark of invalidHwm) {
|
for (const highWaterMark of invalidHwm) {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
new WritableStream(
|
new WritableStream(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-expect-error
|
|
||||||
new CountQueuingStrategy({ highWaterMark })
|
new CountQueuingStrategy({ highWaterMark })
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -45,23 +42,19 @@ unitTest(function streamWriteableHwmError() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
new WritableStream(
|
new WritableStream(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") })
|
new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") as any })
|
||||||
);
|
);
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(function streamTransformHwmError() {
|
unitTest(function streamTransformHwmError() {
|
||||||
const invalidHwm = [NaN, Number("NaN"), {}, -1, "two"];
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const invalidHwm: any[] = [NaN, Number("NaN"), {}, -1, "two"];
|
||||||
for (const highWaterMark of invalidHwm) {
|
for (const highWaterMark of invalidHwm) {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
new TransformStream(
|
new TransformStream(undefined, undefined, { highWaterMark });
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
// @ts-expect-error
|
|
||||||
{ highWaterMark }
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
RangeError,
|
RangeError,
|
||||||
"highWaterMark must be a positive number or Infinity. Received:"
|
"highWaterMark must be a positive number or Infinity. Received:"
|
||||||
|
@ -72,8 +65,8 @@ unitTest(function streamTransformHwmError() {
|
||||||
new TransformStream(
|
new TransformStream(
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
{ highWaterMark: Symbol("hwmk") }
|
{ highWaterMark: Symbol("hwmk") as any }
|
||||||
);
|
);
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
});
|
});
|
||||||
|
|
|
@ -177,8 +177,8 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void {
|
||||||
const searchParams = new URLSearchParams();
|
const searchParams = new URLSearchParams();
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
searchParams[method]();
|
(searchParams as any)[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof TypeError) {
|
if (err instanceof TypeError) {
|
||||||
|
@ -194,8 +194,8 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void {
|
||||||
const searchParams = new URLSearchParams();
|
const searchParams = new URLSearchParams();
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
try {
|
try {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
searchParams[method]("foo");
|
(searchParams as any)[method]("foo");
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof TypeError) {
|
if (err instanceof TypeError) {
|
||||||
|
@ -235,8 +235,10 @@ unitTest(function urlSearchParamsCustomSymbolIterator(): void {
|
||||||
unitTest(
|
unitTest(
|
||||||
function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void {
|
function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void {
|
||||||
const params = {};
|
const params = {};
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
params[Symbol.iterator] = function* (): IterableIterator<[number, number]> {
|
(params as any)[Symbol.iterator] = function* (): IterableIterator<
|
||||||
|
[number, number]
|
||||||
|
> {
|
||||||
yield [1, 2];
|
yield [1, 2];
|
||||||
};
|
};
|
||||||
const params1 = new URLSearchParams((params as unknown) as string[][]);
|
const params1 = new URLSearchParams((params as unknown) as string[][]);
|
||||||
|
|
|
@ -145,8 +145,8 @@ test("multipartMultipartWriter3", async function (): Promise<void> {
|
||||||
);
|
);
|
||||||
await assertThrowsAsync(
|
await assertThrowsAsync(
|
||||||
async (): Promise<void> => {
|
async (): Promise<void> => {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
await mw.writeFile("bar", "file", null);
|
await mw.writeFile("bar", "file", null as any);
|
||||||
},
|
},
|
||||||
Error,
|
Error,
|
||||||
"closed"
|
"closed"
|
||||||
|
|
|
@ -5,5 +5,5 @@ Object.defineProperty(globalThis, Symbol.toStringTag, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
globalThis["global"] = globalThis;
|
(globalThis as any)["global"] = globalThis;
|
||||||
|
|
|
@ -262,10 +262,11 @@ class Module {
|
||||||
if (requireStack.length > 0) {
|
if (requireStack.length > 0) {
|
||||||
message = message + "\nRequire stack:\n- " + requireStack.join("\n- ");
|
message = message + "\nRequire stack:\n- " + requireStack.join("\n- ");
|
||||||
}
|
}
|
||||||
const err = new Error(message);
|
const err = new Error(message) as Error & {
|
||||||
// @ts-expect-error
|
code: string;
|
||||||
|
requireStack: string[];
|
||||||
|
};
|
||||||
err.code = "MODULE_NOT_FOUND";
|
err.code = "MODULE_NOT_FOUND";
|
||||||
// @ts-expect-error
|
|
||||||
err.requireStack = requireStack;
|
err.requireStack = requireStack;
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -732,12 +733,10 @@ function tryPackage(
|
||||||
if (actual === false) {
|
if (actual === false) {
|
||||||
actual = tryExtensions(path.resolve(requestPath, "index"), exts, isMain);
|
actual = tryExtensions(path.resolve(requestPath, "index"), exts, isMain);
|
||||||
if (!actual) {
|
if (!actual) {
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
const err = new Error(
|
const err = new Error(
|
||||||
`Cannot find module '${filename}'. ` +
|
`Cannot find module '${filename}'. ` +
|
||||||
'Please verify that the package.json has a valid "main" entry'
|
'Please verify that the package.json has a valid "main" entry'
|
||||||
);
|
) as Error & { code: string };
|
||||||
// @ts-expect-error
|
|
||||||
err.code = "MODULE_NOT_FOUND";
|
err.code = "MODULE_NOT_FOUND";
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -881,8 +880,7 @@ function applyExports(basePath: string, expansion: string): string {
|
||||||
const e = new Error(
|
const e = new Error(
|
||||||
`Package exports for '${basePath}' do not define ` +
|
`Package exports for '${basePath}' do not define ` +
|
||||||
`a '${mappingKey}' subpath`
|
`a '${mappingKey}' subpath`
|
||||||
);
|
) as Error & { code?: string };
|
||||||
// @ts-expect-error
|
|
||||||
e.code = "MODULE_NOT_FOUND";
|
e.code = "MODULE_NOT_FOUND";
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -973,7 +971,7 @@ function resolveExportsTarget(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let e: Error;
|
let e: Error & { code?: string };
|
||||||
if (mappingKey !== ".") {
|
if (mappingKey !== ".") {
|
||||||
e = new Error(
|
e = new Error(
|
||||||
`Package exports for '${basePath}' do not define a ` +
|
`Package exports for '${basePath}' do not define a ` +
|
||||||
|
@ -982,7 +980,6 @@ function resolveExportsTarget(
|
||||||
} else {
|
} else {
|
||||||
e = new Error(`No valid exports main found for '${basePath}'`);
|
e = new Error(`No valid exports main found for '${basePath}'`);
|
||||||
}
|
}
|
||||||
// @ts-expect-error
|
|
||||||
e.code = "MODULE_NOT_FOUND";
|
e.code = "MODULE_NOT_FOUND";
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -1006,8 +1003,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
get(target, prop): any {
|
get(target: Record<string, any>, prop: string): any {
|
||||||
// @ts-expect-error
|
|
||||||
if (prop in target) return target[prop];
|
if (prop in target) return target[prop];
|
||||||
emitCircularRequireWarning(prop);
|
emitCircularRequireWarning(prop);
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -1058,8 +1054,8 @@ type RequireWrapper = (
|
||||||
function wrapSafe(filename: string, content: string): RequireWrapper {
|
function wrapSafe(filename: string, content: string): RequireWrapper {
|
||||||
// TODO: fix this
|
// TODO: fix this
|
||||||
const wrapper = Module.wrap(content);
|
const wrapper = Module.wrap(content);
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const [f, err] = Deno.core.evalContext(wrapper, filename);
|
const [f, err] = (Deno as any).core.evalContext(wrapper, filename);
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ test({
|
||||||
fn() {
|
fn() {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
// @ts-expect-error
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
signal();
|
(signal as any)();
|
||||||
},
|
},
|
||||||
Error,
|
Error,
|
||||||
"No signals are given. You need to specify at least one signal to create a signal stream."
|
"No signals are given. You need to specify at least one signal to create a signal stream."
|
||||||
|
|
|
@ -491,7 +491,7 @@ export async function handshake(
|
||||||
throw new Error("ws: invalid status line: " + statusLine);
|
throw new Error("ws: invalid status line: " + statusLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error
|
assert(m.groups);
|
||||||
const { version, statusCode } = m.groups;
|
const { version, statusCode } = m.groups;
|
||||||
if (version !== "HTTP/1.1" || statusCode !== "101") {
|
if (version !== "HTTP/1.1" || statusCode !== "101") {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue