mirror of
https://github.com/denoland/deno.git
synced 2025-01-09 15:48:16 -05:00
Use ts-expect-error instead of ts-ignore. (#5869)
This commit is contained in:
parent
24c36fd862
commit
228f9c207f
34 changed files with 81 additions and 94 deletions
|
@ -244,19 +244,19 @@ function prepareStackTrace(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.map((callSite): string => {
|
.map((callSite): string => {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite)));
|
error.__callSiteEvals.push(Object.freeze(evaluateCallSite(callSite)));
|
||||||
const isInternal =
|
const isInternal =
|
||||||
callSite.getFileName()?.startsWith("$deno$") ?? false;
|
callSite.getFileName()?.startsWith("$deno$") ?? false;
|
||||||
const string = callSiteToString(callSite, isInternal);
|
const string = callSiteToString(callSite, isInternal);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
error.__formattedFrames.push(string);
|
error.__formattedFrames.push(string);
|
||||||
return ` at ${colors.stripColor(string)}`;
|
return ` at ${colors.stripColor(string)}`;
|
||||||
})
|
})
|
||||||
.join("\n");
|
.join("\n");
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Object.freeze(error.__callSiteEvals);
|
Object.freeze(error.__callSiteEvals);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Object.freeze(error.__formattedFrames);
|
Object.freeze(error.__formattedFrames);
|
||||||
return errorString;
|
return errorString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
return globalThis.closed;
|
return globalThis.closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
denoNs[internalSymbol] = internalObject;
|
denoNs[internalSymbol] = internalObject;
|
||||||
|
|
||||||
let windowIsClosing = false;
|
let windowIsClosing = false;
|
||||||
|
@ -71,7 +71,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
globalThis.bootstrap = undefined;
|
globalThis.bootstrap = undefined;
|
||||||
log("bootstrapMainRuntime");
|
log("bootstrapMainRuntime");
|
||||||
hasBootstrapped = true;
|
hasBootstrapped = true;
|
||||||
|
|
|
@ -33,7 +33,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
denoNs[internalSymbol] = internalObject;
|
denoNs[internalSymbol] = internalObject;
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
@ -128,7 +128,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
globalThis.bootstrap = undefined;
|
globalThis.bootstrap = undefined;
|
||||||
log("bootstrapWorkerRuntime");
|
log("bootstrapWorkerRuntime");
|
||||||
hasBootstrapped = true;
|
hasBootstrapped = true;
|
||||||
|
|
|
@ -333,11 +333,10 @@ async function runTests({
|
||||||
const filterFn = createFilterFn(filter, skip);
|
const filterFn = createFilterFn(filter, skip);
|
||||||
const testApi = new TestApi(TEST_REGISTRY, filterFn, failFast);
|
const testApi = new TestApi(TEST_REGISTRY, filterFn, failFast);
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const originalConsole = globalThis.console;
|
const originalConsole = globalThis.console;
|
||||||
|
|
||||||
if (disableLog) {
|
if (disableLog) {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
globalThis.console = disabledConsole;
|
globalThis.console = disabledConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +355,6 @@ async function runTests({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disableLog) {
|
if (disableLog) {
|
||||||
// @ts-ignore
|
|
||||||
globalThis.console = originalConsole;
|
globalThis.console = originalConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,6 @@ export class Body implements domTypes.Body {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._bodySource instanceof ReadableStreamImpl) {
|
if (this._bodySource instanceof ReadableStreamImpl) {
|
||||||
// @ts-ignore
|
|
||||||
this._stream = this._bodySource;
|
this._stream = this._bodySource;
|
||||||
}
|
}
|
||||||
if (typeof this._bodySource === "string") {
|
if (typeof this._bodySource === "string") {
|
||||||
|
@ -290,7 +289,6 @@ export class Body implements domTypes.Body {
|
||||||
enc.encode(this._bodySource).buffer as ArrayBuffer
|
enc.encode(this._bodySource).buffer as ArrayBuffer
|
||||||
);
|
);
|
||||||
} else if (this._bodySource instanceof ReadableStreamImpl) {
|
} else if (this._bodySource instanceof ReadableStreamImpl) {
|
||||||
// @ts-ignore
|
|
||||||
return bufferFromStream(this._bodySource.getReader());
|
return bufferFromStream(this._bodySource.getReader());
|
||||||
} else if (this._bodySource instanceof FormData) {
|
} else if (this._bodySource instanceof FormData) {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
|
|
@ -223,7 +223,7 @@ function groupEntries<T>(
|
||||||
let order = "padStart";
|
let order = "padStart";
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
for (let i = 0; i < entries.length; i++) {
|
for (let i = 0; i < entries.length; i++) {
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
if (typeof value[i] !== "number" && typeof value[i] !== "bigint") {
|
if (typeof value[i] !== "number" && typeof value[i] !== "bigint") {
|
||||||
order = "padEnd";
|
order = "padEnd";
|
||||||
break;
|
break;
|
||||||
|
@ -239,7 +239,7 @@ 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-ignore
|
//@ts-expect-error
|
||||||
str += `${entries[j]}, `[order](padding, " ");
|
str += `${entries[j]}, `[order](padding, " ");
|
||||||
}
|
}
|
||||||
if (order === "padStart") {
|
if (order === "padStart") {
|
||||||
|
@ -412,7 +412,7 @@ function createMapString(
|
||||||
},
|
},
|
||||||
group: false,
|
group: false,
|
||||||
};
|
};
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
return createIterableString(value, ctx, level, maxLevel, printConfig);
|
return createIterableString(value, ctx, level, maxLevel, printConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ function createRawObjectString(
|
||||||
let baseString = "";
|
let baseString = "";
|
||||||
|
|
||||||
let shouldShowDisplayName = false;
|
let shouldShowDisplayName = false;
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
let displayName = value[Symbol.toStringTag];
|
let displayName = value[Symbol.toStringTag];
|
||||||
if (!displayName) {
|
if (!displayName) {
|
||||||
displayName = getClassInstanceName(value);
|
displayName = getClassInstanceName(value);
|
||||||
|
@ -515,7 +515,7 @@ function createRawObjectString(
|
||||||
for (const key of symbolKeys) {
|
for (const key of symbolKeys) {
|
||||||
entries.push(
|
entries.push(
|
||||||
`${key.toString()}: ${stringifyWithQuotes(
|
`${key.toString()}: ${stringifyWithQuotes(
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
value[key],
|
value[key],
|
||||||
ctx,
|
ctx,
|
||||||
level + 1,
|
level + 1,
|
||||||
|
@ -949,7 +949,7 @@ export class Console {
|
||||||
name: "Trace",
|
name: "Trace",
|
||||||
message,
|
message,
|
||||||
};
|
};
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Error.captureStackTrace(err, this.trace);
|
Error.captureStackTrace(err, this.trace);
|
||||||
this.error((err as Error).stack);
|
this.error((err as Error).stack);
|
||||||
};
|
};
|
||||||
|
|
|
@ -282,7 +282,7 @@ export async function fetch(
|
||||||
method = input.method;
|
method = input.method;
|
||||||
headers = input.headers;
|
headers = input.headers;
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
if (input._bodySource) {
|
if (input._bodySource) {
|
||||||
body = new DataView(await input.arrayBuffer());
|
body = new DataView(await input.arrayBuffer());
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ export function setTimeout(
|
||||||
...args: Args
|
...args: Args
|
||||||
): number {
|
): number {
|
||||||
checkBigInt(delay);
|
checkBigInt(delay);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
checkThis(this);
|
checkThis(this);
|
||||||
return setTimer(cb, delay, args, false);
|
return setTimer(cb, delay, args, false);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ export function setInterval(
|
||||||
...args: Args
|
...args: Args
|
||||||
): number {
|
): number {
|
||||||
checkBigInt(delay);
|
checkBigInt(delay);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
checkThis(this);
|
checkThis(this);
|
||||||
return setTimer(cb, delay, args, true);
|
return setTimer(cb, delay, args, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Deno.core.evalContext(
|
Deno.core.evalContext(
|
||||||
"(async () => console.log(await import('./subdir/mod4.js')))()"
|
"(async () => console.log(await import('./subdir/mod4.js')))()"
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,7 @@ unitTest(
|
||||||
|
|
||||||
const body = buildBody(text);
|
const body = buildBody(text);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
body.contentType = "multipart/form-data;boundary=boundary";
|
body.contentType = "multipart/form-data;boundary=boundary";
|
||||||
|
|
||||||
const formData = await body.formData();
|
const formData = await body.formData();
|
||||||
|
@ -62,7 +62,7 @@ unitTest(
|
||||||
|
|
||||||
const body = buildBody(text);
|
const body = buildBody(text);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
body.contentType = "application/x-www-form-urlencoded";
|
body.contentType = "application/x-www-form-urlencoded";
|
||||||
|
|
||||||
const formData = await body.formData();
|
const formData = await body.formData();
|
||||||
|
|
|
@ -22,7 +22,7 @@ const customInspect = Deno.customInspect;
|
||||||
const {
|
const {
|
||||||
Console,
|
Console,
|
||||||
stringifyArgs,
|
stringifyArgs,
|
||||||
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
||||||
} = Deno[Deno.internal];
|
} = Deno[Deno.internal];
|
||||||
|
|
||||||
function stringify(...args: unknown[]): string {
|
function stringify(...args: unknown[]): string {
|
||||||
|
@ -590,7 +590,7 @@ unitTest(function consoleTestStringifyIterable() {
|
||||||
0, <120 empty items>
|
0, <120 empty items>
|
||||||
]`
|
]`
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(async function consoleTestStringifyPromises(): Promise<void> {
|
unitTest(async function consoleTestStringifyPromises(): Promise<void> {
|
||||||
|
@ -727,7 +727,6 @@ unitTest(function consoleTestCallToStringOnLabel(): void {
|
||||||
mockConsole((console) => {
|
mockConsole((console) => {
|
||||||
for (const method of methods) {
|
for (const method of methods) {
|
||||||
let hasCalled = false;
|
let hasCalled = false;
|
||||||
// @ts-ignore
|
|
||||||
console[method]({
|
console[method]({
|
||||||
toString(): void {
|
toString(): void {
|
||||||
hasCalled = true;
|
hasCalled = true;
|
||||||
|
|
|
@ -20,9 +20,9 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(function malformedJsonControlBuffer(): void {
|
unitTest(function malformedJsonControlBuffer(): void {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
const opId = Deno.core.ops()["op_open"];
|
const opId = Deno.core.ops()["op_open"];
|
||||||
// @ts-ignore
|
// @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
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
|
|
@ -26,9 +26,9 @@ unitTest(async function sendAsyncStackTrace(): Promise<void> {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(function malformedMinimalControlBuffer(): void {
|
unitTest(function malformedMinimalControlBuffer(): void {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
const readOpId = Deno.core.ops()["op_read"];
|
const readOpId = Deno.core.ops()["op_read"];
|
||||||
// @ts-ignore
|
// @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(
|
||||||
|
|
|
@ -20,7 +20,7 @@ function setup() {
|
||||||
Base,
|
Base,
|
||||||
// This is using an internal API we don't want published as types, so having
|
// This is using an internal API we don't want published as types, so having
|
||||||
// to cast to any to "trick" TypeScript
|
// to cast to any to "trick" TypeScript
|
||||||
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
||||||
DomIterable: Deno[Deno.internal].DomIterableMixin(Base, dataSymbol),
|
DomIterable: Deno[Deno.internal].DomIterableMixin(Base, dataSymbol),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||||
import { unitTest, assert } from "./test_util.ts";
|
import { unitTest, assert } from "./test_util.ts";
|
||||||
|
|
||||||
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
||||||
const { setPrepareStackTrace } = Deno[Deno.internal];
|
const { setPrepareStackTrace } = Deno[Deno.internal];
|
||||||
|
|
||||||
interface CallSite {
|
interface CallSite {
|
||||||
|
|
|
@ -4,11 +4,8 @@ import { unitTest, assertEquals } from "./test_util.ts";
|
||||||
unitTest(function addEventListenerTest(): void {
|
unitTest(function addEventListenerTest(): void {
|
||||||
const document = new EventTarget();
|
const document = new EventTarget();
|
||||||
|
|
||||||
// @ts-ignore tests ignoring the type system for resilience
|
|
||||||
assertEquals(document.addEventListener("x", null, false), undefined);
|
assertEquals(document.addEventListener("x", null, false), undefined);
|
||||||
// @ts-ignore
|
|
||||||
assertEquals(document.addEventListener("x", null, true), undefined);
|
assertEquals(document.addEventListener("x", null, true), undefined);
|
||||||
// @ts-ignore
|
|
||||||
assertEquals(document.addEventListener("x", null), undefined);
|
assertEquals(document.addEventListener("x", null), undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,11 +68,8 @@ unitTest(function anEventTargetCanBeSubclassed(): void {
|
||||||
|
|
||||||
unitTest(function removingNullEventListenerShouldSucceed(): void {
|
unitTest(function removingNullEventListenerShouldSucceed(): void {
|
||||||
const document = new EventTarget();
|
const document = new EventTarget();
|
||||||
// @ts-ignore
|
|
||||||
assertEquals(document.removeEventListener("x", null, false), undefined);
|
assertEquals(document.removeEventListener("x", null, false), undefined);
|
||||||
// @ts-ignore
|
|
||||||
assertEquals(document.removeEventListener("x", null, true), undefined);
|
assertEquals(document.removeEventListener("x", null, true), undefined);
|
||||||
// @ts-ignore
|
|
||||||
assertEquals(document.removeEventListener("x", null), undefined);
|
assertEquals(document.removeEventListener("x", null), undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyUsed(): Promise<
|
||||||
assertEquals(response.bodyUsed, false);
|
assertEquals(response.bodyUsed, false);
|
||||||
assertThrows((): void => {
|
assertThrows((): void => {
|
||||||
// Assigning to read-only property throws in the strict mode.
|
// Assigning to read-only property throws in the strict mode.
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
response.bodyUsed = true;
|
response.bodyUsed = true;
|
||||||
});
|
});
|
||||||
await response.blob();
|
await response.blob();
|
||||||
|
@ -595,7 +595,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyReadTwice(): Promise<
|
||||||
const methods = ["json", "text", "formData", "arrayBuffer"];
|
const methods = ["json", "text", "formData", "arrayBuffer"];
|
||||||
for (const method of methods) {
|
for (const method of methods) {
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @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,7 +290,7 @@ unitTest(
|
||||||
// writing null should throw an error
|
// writing null should throw an error
|
||||||
let err;
|
let err;
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
await file.write(null);
|
await file.write(null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = e;
|
err = e;
|
||||||
|
@ -322,7 +322,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
await file.read(null);
|
await file.read(null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = e;
|
err = e;
|
||||||
|
|
|
@ -41,9 +41,9 @@ 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-ignore
|
// @ts-expect-error
|
||||||
formData.append("d", undefined);
|
formData.append("d", undefined);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
formData.append("e", null);
|
formData.append("e", null);
|
||||||
assertEquals(formData.get("a"), "true");
|
assertEquals(formData.get("a"), "true");
|
||||||
assertEquals(formData.get("b"), "false");
|
assertEquals(formData.get("b"), "false");
|
||||||
|
@ -70,10 +70,10 @@ 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-ignore
|
// @ts-expect-error
|
||||||
formData.set("d", undefined);
|
formData.set("d", undefined);
|
||||||
assertEquals(formData.get("d"), "undefined");
|
assertEquals(formData.get("d"), "undefined");
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
formData.set("e", null);
|
formData.set("e", null);
|
||||||
assertEquals(formData.get("e"), "null");
|
assertEquals(formData.get("e"), "null");
|
||||||
});
|
});
|
||||||
|
@ -134,7 +134,7 @@ unitTest(function formDataParamsArgumentsCheck(): void {
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
formData[method]();
|
formData[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -158,7 +158,7 @@ unitTest(function formDataParamsArgumentsCheck(): void {
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
formData[method]();
|
formData[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -178,7 +178,7 @@ unitTest(function formDataParamsArgumentsCheck(): void {
|
||||||
hasThrown = 0;
|
hasThrown = 0;
|
||||||
errMsg = "";
|
errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
formData[method]("foo");
|
formData[method]("foo");
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -48,12 +48,12 @@ unitTest(function webAssemblyExists(): void {
|
||||||
unitTest(function DenoNamespaceImmutable(): void {
|
unitTest(function DenoNamespaceImmutable(): void {
|
||||||
const denoCopy = window.Deno;
|
const denoCopy = window.Deno;
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Deno = 1;
|
Deno = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(denoCopy === Deno);
|
assert(denoCopy === Deno);
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
window.Deno = 1;
|
window.Deno = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(denoCopy === Deno);
|
assert(denoCopy === Deno);
|
||||||
|
@ -64,7 +64,7 @@ unitTest(function DenoNamespaceImmutable(): void {
|
||||||
|
|
||||||
const { readFile } = Deno;
|
const { readFile } = Deno;
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Deno.readFile = 1;
|
Deno.readFile = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(readFile === Deno.readFile);
|
assert(readFile === Deno.readFile);
|
||||||
|
@ -73,19 +73,19 @@ unitTest(function DenoNamespaceImmutable(): void {
|
||||||
} catch {}
|
} catch {}
|
||||||
assert(readFile === Deno.readFile);
|
assert(readFile === Deno.readFile);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
const { print } = Deno.core;
|
const { print } = Deno.core;
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
Deno.core.print = 1;
|
Deno.core.print = 1;
|
||||||
} catch {}
|
} catch {}
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
assert(print === Deno.core.print);
|
assert(print === Deno.core.print);
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
delete Deno.core.print;
|
delete Deno.core.print;
|
||||||
} catch {}
|
} catch {}
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
assert(print === Deno.core.print);
|
assert(print === Deno.core.print);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
const {
|
const {
|
||||||
stringifyArgs,
|
stringifyArgs,
|
||||||
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
||||||
} = Deno[Deno.internal];
|
} = Deno[Deno.internal];
|
||||||
|
|
||||||
// Logic heavily copied from web-platform-tests, make
|
// Logic heavily copied from web-platform-tests, make
|
||||||
|
@ -18,7 +18,7 @@ unitTest(function newHeaderTest(): void {
|
||||||
new Headers(undefined);
|
new Headers(undefined);
|
||||||
new Headers({});
|
new Headers({});
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
new Headers(null);
|
new Headers(null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -32,7 +32,7 @@ const headerDict: Record<string, string> = {
|
||||||
name1: "value1",
|
name1: "value1",
|
||||||
name2: "value2",
|
name2: "value2",
|
||||||
name3: "value3",
|
name3: "value3",
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
name4: undefined,
|
name4: undefined,
|
||||||
"Content-Type": "value4",
|
"Content-Type": "value4",
|
||||||
};
|
};
|
||||||
|
@ -269,7 +269,7 @@ unitTest(function headerParamsArgumentsCheck(): void {
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
headers[method]();
|
headers[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -293,7 +293,7 @@ unitTest(function headerParamsArgumentsCheck(): void {
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
headers[method]();
|
headers[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -313,7 +313,7 @@ unitTest(function headerParamsArgumentsCheck(): void {
|
||||||
hasThrown = 0;
|
hasThrown = 0;
|
||||||
errMsg = "";
|
errMsg = "";
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
headers[method]("foo");
|
headers[method]("foo");
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { unitTest, assert } from "./test_util.ts";
|
||||||
unitTest(function internalsExists(): void {
|
unitTest(function internalsExists(): void {
|
||||||
const {
|
const {
|
||||||
stringifyArgs,
|
stringifyArgs,
|
||||||
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol
|
||||||
} = Deno[Deno.internal];
|
} = Deno[Deno.internal];
|
||||||
assert(!!stringifyArgs);
|
assert(!!stringifyArgs);
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,7 +10,7 @@ unitTest(function fromInit(): void {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
assertEquals("ahoyhoy", req._bodySource);
|
assertEquals("ahoyhoy", req._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");
|
||||||
|
@ -18,13 +18,13 @@ unitTest(function fromInit(): void {
|
||||||
|
|
||||||
unitTest(function fromRequest(): void {
|
unitTest(function fromRequest(): void {
|
||||||
const r = new Request("https://example.com");
|
const r = new Request("https://example.com");
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
r._bodySource = "ahoyhoy";
|
r._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-ignore
|
// @ts-expect-error
|
||||||
assertEquals(req._bodySource, r._bodySource);
|
assertEquals(req._bodySource, r._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-ignore
|
// @ts-expect-error
|
||||||
assert(r1._bodySource !== r2._bodySource);
|
assert(r1._bodySource !== r2._bodySource);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ unitTest(function streamReadableHwmError() {
|
||||||
() => {
|
() => {
|
||||||
new ReadableStream<number>(
|
new ReadableStream<number>(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
{ highWaterMark }
|
{ highWaterMark }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@ unitTest(function streamReadableHwmError() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
new ReadableStream<number>(
|
new ReadableStream<number>(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
{ highWaterMark: Symbol("hwk") }
|
{ highWaterMark: Symbol("hwk") }
|
||||||
);
|
);
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
|
@ -33,7 +33,7 @@ unitTest(function streamWriteableHwmError() {
|
||||||
() => {
|
() => {
|
||||||
new WritableStream(
|
new WritableStream(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
new CountQueuingStrategy({ highWaterMark })
|
new CountQueuingStrategy({ highWaterMark })
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -45,7 +45,7 @@ unitTest(function streamWriteableHwmError() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
new WritableStream(
|
new WritableStream(
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") })
|
new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") })
|
||||||
);
|
);
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
|
@ -59,7 +59,7 @@ unitTest(function streamTransformHwmError() {
|
||||||
new TransformStream(
|
new TransformStream(
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
{ highWaterMark }
|
{ highWaterMark }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -72,7 +72,7 @@ unitTest(function streamTransformHwmError() {
|
||||||
new TransformStream(
|
new TransformStream(
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
{ highWaterMark: Symbol("hwmk") }
|
{ highWaterMark: Symbol("hwmk") }
|
||||||
);
|
);
|
||||||
}, TypeError);
|
}, TypeError);
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
reportToConn,
|
reportToConn,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
const internalObj = Deno[Deno.internal];
|
const internalObj = Deno[Deno.internal];
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const reportToConsole = internalObj.reportToConsole as (message: any) => void;
|
const reportToConsole = internalObj.reportToConsole as (message: any) => void;
|
||||||
|
|
|
@ -177,7 +177,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void {
|
||||||
const searchParams = new URLSearchParams();
|
const searchParams = new URLSearchParams();
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
searchParams[method]();
|
searchParams[method]();
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -194,7 +194,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void {
|
||||||
const searchParams = new URLSearchParams();
|
const searchParams = new URLSearchParams();
|
||||||
let hasThrown = 0;
|
let hasThrown = 0;
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
searchParams[method]("foo");
|
searchParams[method]("foo");
|
||||||
hasThrown = 1;
|
hasThrown = 1;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -235,7 +235,7 @@ unitTest(function urlSearchParamsCustomSymbolIterator(): void {
|
||||||
unitTest(
|
unitTest(
|
||||||
function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void {
|
function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void {
|
||||||
const params = {};
|
const params = {};
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
params[Symbol.iterator] = function* (): IterableIterator<[number, number]> {
|
params[Symbol.iterator] = function* (): IterableIterator<[number, number]> {
|
||||||
yield [1, 2];
|
yield [1, 2];
|
||||||
};
|
};
|
||||||
|
|
|
@ -496,7 +496,6 @@ test({
|
||||||
async fn(): Promise<void> {
|
async fn(): Promise<void> {
|
||||||
const serverRoutine = async (): Promise<void> => {
|
const serverRoutine = async (): Promise<void> => {
|
||||||
const server = serve(":8124");
|
const server = serve(":8124");
|
||||||
// @ts-ignore
|
|
||||||
for await (const req of server) {
|
for await (const req of server) {
|
||||||
await assertThrowsAsync(async () => {
|
await assertThrowsAsync(async () => {
|
||||||
await req.respond({
|
await req.respond({
|
||||||
|
|
|
@ -145,7 +145,7 @@ test("multipartMultipartWriter3", async function (): Promise<void> {
|
||||||
);
|
);
|
||||||
await assertThrowsAsync(
|
await assertThrowsAsync(
|
||||||
async (): Promise<void> => {
|
async (): Promise<void> => {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
await mw.writeFile("bar", "file", null);
|
await mw.writeFile("bar", "file", null);
|
||||||
},
|
},
|
||||||
Error,
|
Error,
|
||||||
|
|
|
@ -5,5 +5,5 @@ Object.defineProperty(globalThis, Symbol.toStringTag, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
globalThis["global"] = globalThis;
|
globalThis["global"] = globalThis;
|
||||||
|
|
|
@ -263,9 +263,9 @@ class Module {
|
||||||
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);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
err.code = "MODULE_NOT_FOUND";
|
err.code = "MODULE_NOT_FOUND";
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
err.requireStack = requireStack;
|
err.requireStack = requireStack;
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -737,7 +737,7 @@ function tryPackage(
|
||||||
`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'
|
||||||
);
|
);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
err.code = "MODULE_NOT_FOUND";
|
err.code = "MODULE_NOT_FOUND";
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -882,7 +882,7 @@ function applyExports(basePath: string, expansion: string): string {
|
||||||
`Package exports for '${basePath}' do not define ` +
|
`Package exports for '${basePath}' do not define ` +
|
||||||
`a '${mappingKey}' subpath`
|
`a '${mappingKey}' subpath`
|
||||||
);
|
);
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
e.code = "MODULE_NOT_FOUND";
|
e.code = "MODULE_NOT_FOUND";
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
e.code = "MODULE_NOT_FOUND";
|
e.code = "MODULE_NOT_FOUND";
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -1007,7 +1007,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, prop): any {
|
||||||
// @ts-ignore
|
// @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,7 +1058,7 @@ 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-ignore
|
// @ts-expect-error
|
||||||
const [f, err] = Deno.core.evalContext(wrapper, filename);
|
const [f, err] = Deno.core.evalContext(wrapper, filename);
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -9,7 +9,7 @@ test({
|
||||||
fn() {
|
fn() {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
signal();
|
signal();
|
||||||
},
|
},
|
||||||
Error,
|
Error,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||||
import { assert } from "../../testing/asserts.ts";
|
import { assert } from "../../testing/asserts.ts";
|
||||||
const { test } = Deno;
|
const { test } = Deno;
|
||||||
// @ts-ignore
|
|
||||||
import { NIL_UUID, isNil } from "../mod.ts";
|
import { NIL_UUID, isNil } from "../mod.ts";
|
||||||
|
|
||||||
test({
|
test({
|
||||||
|
|
|
@ -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-ignore
|
// @ts-expect-error
|
||||||
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…
Reference in a new issue