From baea9b27eb524afaaada6b7a7a0a63c8bb61c74b Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Wed, 27 May 2020 00:02:16 +1000 Subject: [PATCH] Use ts-expect-error instead of ts-ignore. (denoland/deno#5869) --- http/server_test.ts | 1 - mime/multipart_test.ts | 2 +- node/global.ts | 2 +- node/module.ts | 14 +++++++------- signal/test.ts | 2 +- uuid/tests/isNil.ts | 1 - ws/mod.ts | 2 +- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/http/server_test.ts b/http/server_test.ts index 0560f7f8daab5..0423b872626eb 100644 --- a/http/server_test.ts +++ b/http/server_test.ts @@ -496,7 +496,6 @@ test({ async fn(): Promise { const serverRoutine = async (): Promise => { const server = serve(":8124"); - // @ts-ignore for await (const req of server) { await assertThrowsAsync(async () => { await req.respond({ diff --git a/mime/multipart_test.ts b/mime/multipart_test.ts index 61afdba03635b..b7c0cb969c5dc 100644 --- a/mime/multipart_test.ts +++ b/mime/multipart_test.ts @@ -145,7 +145,7 @@ test("multipartMultipartWriter3", async function (): Promise { ); await assertThrowsAsync( async (): Promise => { - // @ts-ignore + // @ts-expect-error await mw.writeFile("bar", "file", null); }, Error, diff --git a/node/global.ts b/node/global.ts index c877d1d531b3c..7d147cc4b1de8 100644 --- a/node/global.ts +++ b/node/global.ts @@ -5,5 +5,5 @@ Object.defineProperty(globalThis, Symbol.toStringTag, { configurable: true, }); -// @ts-ignore +// @ts-expect-error globalThis["global"] = globalThis; diff --git a/node/module.ts b/node/module.ts index 4e0c55c1d84a6..71c25beacaf8d 100644 --- a/node/module.ts +++ b/node/module.ts @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; @@ -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; diff --git a/signal/test.ts b/signal/test.ts index 15ebbdcc723c3..13c2998db1f8b 100644 --- a/signal/test.ts +++ b/signal/test.ts @@ -9,7 +9,7 @@ test({ fn() { assertThrows( () => { - // @ts-ignore + // @ts-expect-error signal(); }, Error, diff --git a/uuid/tests/isNil.ts b/uuid/tests/isNil.ts index 4514576daa760..1f0db416e2bfa 100644 --- a/uuid/tests/isNil.ts +++ b/uuid/tests/isNil.ts @@ -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({ diff --git a/ws/mod.ts b/ws/mod.ts index 324588af01db5..97c77baab024d 100644 --- a/ws/mod.ts +++ b/ws/mod.ts @@ -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(