Skip to content

Commit

Permalink
feat(cli): update to TypeScript 4.1 (denoland/deno#7573)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored and denobot committed Feb 1, 2021
1 parent ae50f9d commit 79c117e
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/chat/server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve) => {
ws.onmessage = ((message) => {
assertEquals(message.data, "Connected: [1]");
ws.onmessage = ((message) => {
Expand Down
10 changes: 5 additions & 5 deletions node/_fs/_fs_appendFile_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Deno.test({
write: true,
read: true,
});
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
appendFile(file.rid, "hello world", (err) => {
if (err) reject();
else resolve();
Expand All @@ -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<void>((resolve, reject) => {
appendFile("_fs_appendFile_test_file.txt", "hello world", (err) => {
if (err) reject(err);
else resolve();
Expand All @@ -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<void>((resolve, reject) => {
appendFile(fileURL, "hello world", (err) => {
if (err) reject(err);
else resolve();
Expand All @@ -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<void>((resolve, reject) => {
appendFile(tempFile, "hello world", { flag: "ax" }, (err) => {
if (err) reject(err);
else resolve();
Expand Down Expand Up @@ -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<void>((resolve, reject) => {
appendFile("_fs_appendFile_test_file.txt", testData, (err) => {
if (err) reject(err);
else resolve();
Expand Down
2 changes: 1 addition & 1 deletion node/_fs/_fs_chmod_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve, reject) => {
chmod(tempFile, 0o777, (err) => {
if (err) reject(err);
else resolve();
Expand Down
2 changes: 1 addition & 1 deletion node/_fs/_fs_chown_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve, reject) => {
chown(tempFile, originalUserId!, originalGroupId!, (err) => {
if (err) reject(err);
else resolve();
Expand Down
6 changes: 3 additions & 3 deletions node/_fs/_fs_close_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve, reject) => {
close(file.rid, (err) => {
if (err !== null) reject();
else resolve();
Expand All @@ -30,7 +30,7 @@ Deno.test({
Deno.test({
name: "ASYNC: Invalid fd",
async fn() {
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
close(-1, (err) => {
if (err !== null) return resolve();
reject();
Expand All @@ -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<void>((resolve) => {
close(file.rid, () => {
assert(foo === "bar");
resolve();
Expand Down
4 changes: 2 additions & 2 deletions node/_fs/_fs_link_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((res, rej) => {
link(tempFile, linkedFile, (err) => {
if (err) rej(err);
else res();
Expand All @@ -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<void>((res, rej) => {
link("no-such-file", "no-such-file", (err) => {
if (err) rej(err);
else res();
Expand Down
2 changes: 1 addition & 1 deletion node/_fs/_fs_rename_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve, reject) => {
rename(file, newPath, (err) => {
if (err) reject(err);
resolve();
Expand Down
4 changes: 2 additions & 2 deletions node/_fs/_fs_rmdir_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve, reject) => {
rmdir(dir, (err) => {
if (err) reject(err);
resolve();
Expand Down Expand Up @@ -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<void>((resolve, reject) => {
rmdir(dir, { recursive: true }, (err) => {
if (err) reject(err);
resolve();
Expand Down
2 changes: 1 addition & 1 deletion node/_fs/_fs_unlink_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve, reject) => {
unlink(file, (err) => {
if (err) reject(err);
resolve();
Expand Down
4 changes: 2 additions & 2 deletions node/_fs/_fs_writeFile_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Deno.test(
read: true,
});

await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
writeFile(file.rid, "hello world", (err) => {
if (err) return reject(err);
resolve();
Expand Down Expand Up @@ -207,7 +207,7 @@ Deno.test(
read: true,
});

await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
writeFile(file.rid, "hello world", { mode: 0o777 }, (err) => {
if (err) return reject(err);
resolve();
Expand Down

0 comments on commit 79c117e

Please sign in to comment.