Skip to content

Commit

Permalink
refactor: prepare for Deno 2
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Sep 11, 2024
1 parent 442871e commit 15c1e8c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions e2e_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
assertEquals,
assertInstanceOf,
assertNotEquals,
assertObjectMatch,
assertStringIncludes,
} from "$std/assert/mod.ts";
import { isRedirectStatus, STATUS_CODE } from "$std/http/status.ts";
Expand Down Expand Up @@ -422,7 +421,7 @@ Deno.test("[e2e] POST /submit", async (test) => {

assertRedirect(resp, "/");
// Deep partial match since the item ID is a ULID generated at runtime
assertObjectMatch(items[0], item);
assertEquals(items[0], item);
});
});

Expand Down
2 changes: 1 addition & 1 deletion islands/ItemsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function ItemsList(props: ItemsListProps) {
itemsSig.value = [...itemsSig.value, ...values];
cursorSig.value = cursor;
} catch (error) {
console.error(error.message);
console.error((error as Error).message);
} finally {
isLoadingSig.value = false;
}
Expand Down
2 changes: 1 addition & 1 deletion islands/UsersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function UsersTable(props: UsersTableProps) {
usersSig.value = [...usersSig.value, ...values];
cursorSig.value = cursor;
} catch (error) {
console.log(error.message);
console.log((error as Error).message);
} finally {
isLoadingSig.value = false;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/blog/routes/blog/[slug].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023-2024 the Deno authors. All rights reserved. MIT license.
import { defineRoute } from "$fresh/server.ts";
import { CSS, render } from "https://deno.land/x/gfm@0.2.5/mod.ts";
import { CSS, render } from "jsr:@deno/gfm@^0.9";
import { getPost } from "../../utils/posts.ts";
import Head from "@/components/Head.tsx";
import Share from "../../components/Share.tsx";
Expand Down
4 changes: 2 additions & 2 deletions plugins/error_handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default {
try {
return await ctx.next();
} catch (error) {
const status = toErrorStatus(error);
return new Response(error.message, {
const status = toErrorStatus(error as Error);
return new Response((error as Error).message, {
statusText: STATUS_TEXT[status],
status,
});
Expand Down
2 changes: 1 addition & 1 deletion routes/api/stripe-webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const handler: Handlers = {
cryptoProvider,
);
} catch (error) {
throw new BadRequestError(error.message);
throw new BadRequestError((error as Error).message);
}

// @ts-ignore: Property 'customer' actually does exist on type 'Object'
Expand Down
4 changes: 2 additions & 2 deletions utils/github_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Deno.test("[plugins] getGitHubUser()", async (test) => {
await test.step("rejects on error message", async () => {
const message = crypto.randomUUID();
const fetchStub = stub(
window,
globalThis,
"fetch",
returnsNext([
Promise.resolve(
Expand All @@ -29,7 +29,7 @@ Deno.test("[plugins] getGitHubUser()", async (test) => {
await test.step("resolves to a GitHub user object", async () => {
const body = { login: crypto.randomUUID(), email: crypto.randomUUID() };
const fetchStub = stub(
window,
globalThis,
"fetch",
returnsNext([Promise.resolve(Response.json(body))]),
);
Expand Down

0 comments on commit 15c1e8c

Please sign in to comment.