summaryrefslogtreecommitdiff
path: root/cli/js/web
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/web')
-rw-r--r--cli/js/web/console.ts26
-rw-r--r--cli/js/web/fetch.ts3
-rw-r--r--cli/js/web/timers.ts4
3 files changed, 18 insertions, 15 deletions
diff --git a/cli/js/web/console.ts b/cli/js/web/console.ts
index 4b5423631..9f166b373 100644
--- a/cli/js/web/console.ts
+++ b/cli/js/web/console.ts
@@ -216,14 +216,18 @@ function groupEntries<T>(
lineMaxLength += separatorSpace;
maxLineLength[i] = lineMaxLength;
}
- let order = "padStart";
+ let order: "padStart" | "padEnd" = "padStart";
if (value !== undefined) {
for (let i = 0; i < entries.length; i++) {
- //@ts-expect-error
- if (typeof value[i] !== "number" && typeof value[i] !== "bigint") {
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ if (
+ typeof (value as any)[i] !== "number" &&
+ typeof (value as any)[i] !== "bigint"
+ ) {
order = "padEnd";
break;
}
+ /* eslint-enable */
}
}
// Each iteration creates a single line of grouped entries.
@@ -235,7 +239,6 @@ function groupEntries<T>(
for (; j < max - 1; j++) {
// In future, colors should be taken here into the account
const padding = maxLineLength[j - i];
- //@ts-expect-error
str += `${entries[j]}, `[order](padding, " ");
}
if (order === "padStart") {
@@ -408,8 +411,8 @@ function createMapString(
},
group: false,
};
- //@ts-expect-error
- return createIterableString(value, ctx, level, maxLevel, printConfig);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ return createIterableString(value as any, ctx, level, maxLevel, printConfig);
}
function createWeakSetString(): string {
@@ -477,7 +480,7 @@ function createPromiseString(
// TODO: Proxy
function createRawObjectString(
- value: { [key: string]: unknown },
+ value: Record<string, unknown>,
ctx: ConsoleContext,
level: number,
maxLevel: number
@@ -490,8 +493,9 @@ function createRawObjectString(
let baseString = "";
let shouldShowDisplayName = false;
- // @ts-expect-error
- let displayName = value[Symbol.toStringTag];
+ let displayName = (value as { [Symbol.toStringTag]: string })[
+ Symbol.toStringTag
+ ];
if (!displayName) {
displayName = getClassInstanceName(value);
}
@@ -511,8 +515,8 @@ function createRawObjectString(
for (const key of symbolKeys) {
entries.push(
`${key.toString()}: ${stringifyWithQuotes(
- // @ts-expect-error
- value[key],
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ value[key as any],
ctx,
level + 1,
maxLevel
diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts
index c63fa698f..1f0242a96 100644
--- a/cli/js/web/fetch.ts
+++ b/cli/js/web/fetch.ts
@@ -187,7 +187,7 @@ function sendFetchReq(
}
export async function fetch(
- input: domTypes.Request | URL | string,
+ input: (domTypes.Request & { _bodySource?: unknown }) | URL | string,
init?: domTypes.RequestInit
): Promise<Response> {
let url: string;
@@ -285,7 +285,6 @@ export async function fetch(
method = input.method;
headers = input.headers;
- //@ts-expect-error
if (input._bodySource) {
body = new DataView(await input.arrayBuffer());
}
diff --git a/cli/js/web/timers.ts b/cli/js/web/timers.ts
index 87b23de06..245d6a8c7 100644
--- a/cli/js/web/timers.ts
+++ b/cli/js/web/timers.ts
@@ -234,23 +234,23 @@ function setTimer(
}
export function setTimeout(
+ this: unknown,
cb: (...args: Args) => void,
delay = 0,
...args: Args
): number {
checkBigInt(delay);
- // @ts-expect-error
checkThis(this);
return setTimer(cb, delay, args, false);
}
export function setInterval(
+ this: unknown,
cb: (...args: Args) => void,
delay = 0,
...args: Args
): number {
checkBigInt(delay);
- // @ts-expect-error
checkThis(this);
return setTimer(cb, delay, args, true);
}