From 2f5c0a19b78ab127c1558399a0bae463d66a995f Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 24 Nov 2020 09:31:10 +1100 Subject: [PATCH] feat(cli): update to TypeScript 4.1 (denoland/deno#7573) --- examples/chat/server_test.ts | 2 +- node/_fs/_fs_appendFile_test.ts | 10 +++++----- node/_fs/_fs_chmod_test.ts | 2 +- node/_fs/_fs_chown_test.ts | 2 +- node/_fs/_fs_close_test.ts | 6 +++--- node/_fs/_fs_link_test.ts | 4 ++-- node/_fs/_fs_rename_test.ts | 2 +- node/_fs/_fs_rmdir_test.ts | 4 ++-- node/_fs/_fs_unlink_test.ts | 2 +- node/_fs/_fs_writeFile_test.ts | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/chat/server_test.ts b/examples/chat/server_test.ts index 9bc1c9823f91..f9a4baae3ac0 100644 --- a/examples/chat/server_test.ts +++ b/examples/chat/server_test.ts @@ -60,7 +60,7 @@ Deno.test({ let ws: WebSocket; try { ws = new WebSocket("ws://127.0.0.1:8080/ws"); - await new Promise((resolve) => { + await new Promise((resolve) => { ws.onmessage = ((message) => { assertEquals(message.data, "Connected: [1]"); ws.onmessage = ((message) => { diff --git a/node/_fs/_fs_appendFile_test.ts b/node/_fs/_fs_appendFile_test.ts index 5d9e6f96dce5..d9aea35350ea 100644 --- a/node/_fs/_fs_appendFile_test.ts +++ b/node/_fs/_fs_appendFile_test.ts @@ -69,7 +69,7 @@ Deno.test({ write: true, read: true, }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { appendFile(file.rid, "hello world", (err) => { if (err) reject(); else resolve(); @@ -93,7 +93,7 @@ Deno.test({ name: "Async: Data is written to passed in file path", async fn() { const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources(); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { appendFile("_fs_appendFile_test_file.txt", "hello world", (err) => { if (err) reject(err); else resolve(); @@ -118,7 +118,7 @@ Deno.test({ async fn() { const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources(); const fileURL = new URL("_fs_appendFile_test_file.txt", import.meta.url); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { appendFile(fileURL, "hello world", (err) => { if (err) reject(err); else resolve(); @@ -144,7 +144,7 @@ Deno.test({ async fn() { const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources(); const tempFile: string = await Deno.makeTempFile(); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { appendFile(tempFile, "hello world", { flag: "ax" }, (err) => { if (err) reject(err); else resolve(); @@ -225,7 +225,7 @@ Deno.test({ async fn() { const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources(); const testData = new TextEncoder().encode("hello world"); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { appendFile("_fs_appendFile_test_file.txt", testData, (err) => { if (err) reject(err); else resolve(); diff --git a/node/_fs/_fs_chmod_test.ts b/node/_fs/_fs_chmod_test.ts index a9ff7ed7d799..e0141b4f42bc 100644 --- a/node/_fs/_fs_chmod_test.ts +++ b/node/_fs/_fs_chmod_test.ts @@ -8,7 +8,7 @@ Deno.test({ async fn() { const tempFile: string = await Deno.makeTempFile(); const originalFileMode: number | null = (await Deno.lstat(tempFile)).mode; - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { chmod(tempFile, 0o777, (err) => { if (err) reject(err); else resolve(); diff --git a/node/_fs/_fs_chown_test.ts b/node/_fs/_fs_chown_test.ts index b053a7584f05..e3f39553c44a 100644 --- a/node/_fs/_fs_chown_test.ts +++ b/node/_fs/_fs_chown_test.ts @@ -13,7 +13,7 @@ Deno.test({ const tempFile: string = await Deno.makeTempFile(); const originalUserId: number | null = (await Deno.lstat(tempFile)).uid; const originalGroupId: number | null = (await Deno.lstat(tempFile)).gid; - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { chown(tempFile, originalUserId!, originalGroupId!, (err) => { if (err) reject(err); else resolve(); diff --git a/node/_fs/_fs_close_test.ts b/node/_fs/_fs_close_test.ts index 17321381687d..1e61ede3675d 100644 --- a/node/_fs/_fs_close_test.ts +++ b/node/_fs/_fs_close_test.ts @@ -9,7 +9,7 @@ Deno.test({ const file: Deno.File = await Deno.open(tempFile); assert(Deno.resources()[file.rid]); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { close(file.rid, (err) => { if (err !== null) reject(); else resolve(); @@ -30,7 +30,7 @@ Deno.test({ Deno.test({ name: "ASYNC: Invalid fd", async fn() { - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { close(-1, (err) => { if (err !== null) return resolve(); reject(); @@ -46,7 +46,7 @@ Deno.test({ const file: Deno.File = Deno.openSync(tempFile); let foo: string; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { close(file.rid, () => { assert(foo === "bar"); resolve(); diff --git a/node/_fs/_fs_link_test.ts b/node/_fs/_fs_link_test.ts index 7d1cbfd4fb8d..6cb3a4d6dd4c 100644 --- a/node/_fs/_fs_link_test.ts +++ b/node/_fs/_fs_link_test.ts @@ -8,7 +8,7 @@ Deno.test({ async fn() { const tempFile: string = await Deno.makeTempFile(); const linkedFile: string = tempFile + ".link"; - await new Promise((res, rej) => { + await new Promise((res, rej) => { link(tempFile, linkedFile, (err) => { if (err) rej(err); else res(); @@ -31,7 +31,7 @@ Deno.test({ name: "ASYNC: hard linking files passes error to callback", async fn() { let failed = false; - await new Promise((res, rej) => { + await new Promise((res, rej) => { link("no-such-file", "no-such-file", (err) => { if (err) rej(err); else res(); diff --git a/node/_fs/_fs_rename_test.ts b/node/_fs/_fs_rename_test.ts index d0084d0d12dc..d0ba896446c5 100644 --- a/node/_fs/_fs_rename_test.ts +++ b/node/_fs/_fs_rename_test.ts @@ -8,7 +8,7 @@ Deno.test({ async fn() { const file = Deno.makeTempFileSync(); const newPath = join(parse(file).dir, `${parse(file).base}_renamed`); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { rename(file, newPath, (err) => { if (err) reject(err); resolve(); diff --git a/node/_fs/_fs_rmdir_test.ts b/node/_fs/_fs_rmdir_test.ts index 884d4912acbc..006bd7b9dac8 100644 --- a/node/_fs/_fs_rmdir_test.ts +++ b/node/_fs/_fs_rmdir_test.ts @@ -8,7 +8,7 @@ Deno.test({ name: "ASYNC: removing empty folder", async fn() { const dir = Deno.makeTempDirSync(); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { rmdir(dir, (err) => { if (err) reject(err); resolve(); @@ -52,7 +52,7 @@ Deno.test({ Deno.createSync(join(dir, "file2.txt")); Deno.mkdirSync(join(dir, "some_dir")); Deno.createSync(join(dir, "some_dir", "file.txt")); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { rmdir(dir, { recursive: true }, (err) => { if (err) reject(err); resolve(); diff --git a/node/_fs/_fs_unlink_test.ts b/node/_fs/_fs_unlink_test.ts index 922a1a703baf..46cde60b1e06 100644 --- a/node/_fs/_fs_unlink_test.ts +++ b/node/_fs/_fs_unlink_test.ts @@ -6,7 +6,7 @@ Deno.test({ name: "ASYNC: deleting a file", async fn() { const file = Deno.makeTempFileSync(); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { unlink(file, (err) => { if (err) reject(err); resolve(); diff --git a/node/_fs/_fs_writeFile_test.ts b/node/_fs/_fs_writeFile_test.ts index 6d50d1013d72..845d4a155f33 100644 --- a/node/_fs/_fs_writeFile_test.ts +++ b/node/_fs/_fs_writeFile_test.ts @@ -101,7 +101,7 @@ Deno.test( read: true, }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { writeFile(file.rid, "hello world", (err) => { if (err) return reject(err); resolve(); @@ -207,7 +207,7 @@ Deno.test( read: true, }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { writeFile(file.rid, "hello world", { mode: 0o777 }, (err) => { if (err) return reject(err); resolve();