Skip to content

Commit

Permalink
Use ts-expect-error instead of ts-ignore. (denoland/deno#5869)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored May 26, 2020
1 parent baca8bf commit baea9b2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion http/server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ test({
async fn(): Promise<void> {
const serverRoutine = async (): Promise<void> => {
const server = serve(":8124");
// @ts-ignore
for await (const req of server) {
await assertThrowsAsync(async () => {
await req.respond({
Expand Down
2 changes: 1 addition & 1 deletion mime/multipart_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test("multipartMultipartWriter3", async function (): Promise<void> {
);
await assertThrowsAsync(
async (): Promise<void> => {
// @ts-ignore
// @ts-expect-error
await mw.writeFile("bar", "file", null);
},
Error,
Expand Down
2 changes: 1 addition & 1 deletion node/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Object.defineProperty(globalThis, Symbol.toStringTag, {
configurable: true,
});

// @ts-ignore
// @ts-expect-error
globalThis["global"] = globalThis;
14 changes: 7 additions & 7 deletions node/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ class Module {
message = message + "\nRequire stack:\n- " + requireStack.join("\n- ");
}
const err = new Error(message);
// @ts-ignore
// @ts-expect-error
err.code = "MODULE_NOT_FOUND";
// @ts-ignore
// @ts-expect-error
err.requireStack = requireStack;
throw err;
}
Expand Down Expand Up @@ -737,7 +737,7 @@ function tryPackage(
`Cannot find module '${filename}'. ` +
'Please verify that the package.json has a valid "main" entry'
);
// @ts-ignore
// @ts-expect-error
err.code = "MODULE_NOT_FOUND";
throw err;
}
Expand Down Expand Up @@ -882,7 +882,7 @@ function applyExports(basePath: string, expansion: string): string {
`Package exports for '${basePath}' do not define ` +
`a '${mappingKey}' subpath`
);
// @ts-ignore
// @ts-expect-error
e.code = "MODULE_NOT_FOUND";
throw e;
}
Expand Down Expand Up @@ -982,7 +982,7 @@ function resolveExportsTarget(
} else {
e = new Error(`No valid exports main found for '${basePath}'`);
}
// @ts-ignore
// @ts-expect-error
e.code = "MODULE_NOT_FOUND";
throw e;
}
Expand All @@ -1007,7 +1007,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy(
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
get(target, prop): any {
// @ts-ignore
// @ts-expect-error
if (prop in target) return target[prop];
emitCircularRequireWarning(prop);
return undefined;
Expand Down Expand Up @@ -1058,7 +1058,7 @@ type RequireWrapper = (
function wrapSafe(filename: string, content: string): RequireWrapper {
// TODO: fix this
const wrapper = Module.wrap(content);
// @ts-ignore
// @ts-expect-error
const [f, err] = Deno.core.evalContext(wrapper, filename);
if (err) {
throw err;
Expand Down
2 changes: 1 addition & 1 deletion signal/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test({
fn() {
assertThrows(
() => {
// @ts-ignore
// @ts-expect-error
signal();
},
Error,
Expand Down
1 change: 0 additions & 1 deletion uuid/tests/isNil.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert } from "../../testing/asserts.ts";
const { test } = Deno;
// @ts-ignore
import { NIL_UUID, isNil } from "../mod.ts";

test({
Expand Down
2 changes: 1 addition & 1 deletion ws/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export async function handshake(
throw new Error("ws: invalid status line: " + statusLine);
}

// @ts-ignore
// @ts-expect-error
const { version, statusCode } = m.groups;
if (version !== "HTTP/1.1" || statusCode !== "101") {
throw new Error(
Expand Down

0 comments on commit baea9b2

Please sign in to comment.