Skip to content

Conversation

@BarryThePenguin
Copy link
Contributor

I've been looking at the new TypeScript errors in #1691

One relates to compatibility between Uint8Array and BufferSource, so I've addressed that and a number of other small improvements

@changeset-bot
Copy link

changeset-bot bot commented Jan 24, 2026

⚠️ No Changeset found

Latest commit: 724701a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.68%. Comparing base (2713f55) to head (724701a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1717      +/-   ##
==========================================
- Coverage   92.69%   92.68%   -0.01%     
==========================================
  Files         112      112              
  Lines        3737     3734       -3     
  Branches      946      946              
==========================================
- Hits         3464     3461       -3     
  Misses        245      245              
  Partials       28       28              
Flag Coverage Δ
auth-js 98.57% <ø> (ø)
cloudflare-access 100.00% <100.00%> (ø)
mcp 90.51% <ø> (ø)
swagger-ui 95.00% <ø> (ø)
ua-blocker 88.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor Author

@BarryThePenguin BarryThePenguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if these changes require a release, but I can put together a changeset if you think it should 👍🏻

"eslint-plugin-import-x": "^4.1.1",
"eslint-plugin-n": "^17.10.2",
"typescript-eslint": "^8.27.0"
"typescript-eslint": "^8.53.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded typescript-eslint as there have been a number of bug fixes that are worth including

Comment on lines +177 to +178
signature: BufferSource,
data: BufferSource
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change I wanted to make

Comment on lines +280 to +281
iat: expect.any(Number) as number,
exp: expect.any(Number) as number,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect.any() currently returns any. vitest has plans to change it to unknown so it works nicely with @typescript-eslint/no-unsafe-assignment

}

const data: any = await result.json()
const data = await result.json<{ keys: JsonWebKeyWithKid[] }>()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches the types that /cdn-cgi/access/certs returns

Comment on lines +145 to +146
const [header, payload, signature] = token.split('.')
if (!header || !payload || !signature) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for undefined indexed values here means one less type assertion

Comment on lines +151 to +154
header: JSON.parse(atob(header)) as object,
payload: JSON.parse(atob(payload)) as CloudflareAccessPayload,
signature: atob(signature.replace(/_/g, '/').replace(/-/g, '+')),
raw: { header, payload, signature },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less assignments using any, but still using a few type assertions..

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

@BarryThePenguin

Nice improvements! Thanks.

@yusukebe yusukebe merged commit b532f31 into honojs:main Jan 24, 2026
97 checks passed
@BarryThePenguin BarryThePenguin deleted the refactor/cloudflare-access-types branch January 24, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants