Skip to content

fix(codegen): new:resource emits requireAuth (createAuthMiddleware does not exist)#277

Merged
agjs merged 1 commit into
mainfrom
fix/new-resource-requireauth
Jul 12, 2026
Merged

fix(codegen): new:resource emits requireAuth (createAuthMiddleware does not exist)#277
agjs merged 1 commit into
mainfrom
fix/new-resource-requireauth

Conversation

@agjs

@agjs agjs commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

The new:resource template imported createAuthMiddleware from auth.plugin, but that module only exports requireAuth/tryAuth — so every generated resource failed typecheck (TS2305 + implicit-any cascade). Real resources (e.g. dashboard.routes.ts) use requireAuth(); this aligns the generator with them.

Verified: a generated resource typechecks + passes apps/api bun run validate after this change.

(Discovered by tsforge's harness driving new:resource end-to-end.)

…es not exist)

The new:resource template imported `createAuthMiddleware` from auth.plugin, but that module only exports `requireAuth`/`tryAuth` — so every generated resource failed typecheck (TS2305 + cascade). Real resources (e.g. dashboard.routes) use `requireAuth()`; align the generator with them. Verified: a generated resource now typechecks + passes the api gate.
@agjs agjs merged commit e798aef into main Jul 12, 2026
29 checks passed
@agjs agjs deleted the fix/new-resource-requireauth branch July 12, 2026 16:16
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.

1 participant