Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: prepare for Deno 2 #685

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
strategy:
fail-fast: false
matrix:
deno:
- "1.x"
- canary
os:
- ubuntu-latest
- windows-latest
Expand All @@ -23,6 +26,8 @@ jobs:

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}

- name: Check typos
if: matrix.os == 'ubuntu-latest'
Expand Down
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
Loading