refactor(global-variables): strip remaining any from adminRoutes + resolver (types-only) - #1025
Open
mmcintosh wants to merge 1 commit into
Open
refactor(global-variables): strip remaining any from adminRoutes + resolver (types-only)#1025mmcintosh wants to merge 1 commit into
mmcintosh wants to merge 1 commit into
Conversation
mmcintosh
marked this pull request as ready for review
July 24, 2026 19:55
…resolver (types-only)
Follow-up to the auth fix (Split scope): types the adminRoutes surface and
variable-resolver.ts that the security PR deferred. No behavior change.
- adminRoutes typed as new Hono<{Bindings;Variables}> (removes every `c: any`); the
plugin-active gate returns next() to satisfy noImplicitReturns.
- Row projections typed (PluginSettingsRow) instead of `.first() as any`; parsed
settings typed (GvSettings); the variables list typed (FormattedVariable)
end-to-end into renderAdminPage.
- variable-resolver.ts: db -> D1Database, the recursive resolver obj/return -> unknown,
and the row read typed via .all<{key,value}>() (drops the `(row as any)` casts).
- install/uninstall context typed (the SDK types it `unknown`) via a minimal
LifecycleContext narrowing.
Deferred (1 handler, 2 `any`): the `content:read` hook — its typed payload is
ContentEventPayload, but the handler treats `data` as the content itself and reads
`context.context.env.DB`; reconciling that (plus the event's reserved/unwired
dispatch) is a behavior change, not a types-only strip. Noted in-code.
Net: global-variables-plugin `any` count 26 -> 2. tsc clean; resolver test 13/13.
mmcintosh
force-pushed
the
fix/global-variables-typing
branch
from
August 17, 2026 23:53
5f8cd80 to
8ff049a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to the auth fix (#1024, which was intentionally "Split scope"): types the
adminRoutessurface andvariable-resolver.tsthat the security PR deferred so the security change stayed reviewable. Types-only — no behavior change (resolver test 13/13, tsc clean).Changes
adminRoutestypednew Hono<{ Bindings; Variables }>()— removes everyc: any/(c: any, next: any)(same pattern asapiRoutesin fix(global-variables): require auth on the /api/global-variables routes #1024). The plugin-active gatereturnsnext()to satisfynoImplicitReturns.PluginSettingsRowreplaces.first() as any; parsed plugin settings typed asGvSettings; the admin variable list typedFormattedVariable[]end-to-end intorenderAdminPage.variable-resolver.ts—db: any → D1Database; the recursiveresolveVariablesInObject/resolveContentVariablesany → unknown; the row read typed via.all<{ key; value }>()(drops the(row as any)casts).install/uninstall— context typed (the SDK types itunknown) via a minimalLifecycleContextnarrowing.Net: plugin
anycount 26 → 2.Deferred (with reason)
The
content:readhook keepsdata: any, context: any(the only remaining 2). Its typed payload isContentEventPayload(content at.data), but the handler treatsdataas the content itself and readscontext.context.env.DB— and the event is currently reserved/unwired (no dispatch site). Reconciling that is a behavior change, out of scope for a types-only PR; flagged in an in-code note.Testing
tsc --noEmitclean for the plugin and project-wide (external callers —api-content-crud,core-plugins/index, the resolver test — all still compile against the stricterunknown).global-variables-resolver.test.ts13/13.Unit Tests
E2E Tests
Screenshots/Videos
N/A — no behavior/UI change.
Checklist