Repository navigation
docs: annotate handlers with (c: CtxCore), the scriptc-compilable form - #90
Merged
Merged
Conversation
scriptc refuses unannotated handler params ('any') and the Ctx<P>
generic interface (SC2009); CtxCore is the runtime class Handler is
typed on. Fixes the @chttp/auth README quickstart (cutils#29) and the
same handler idiom across the docs site and package READMEs.
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Deploying chttpjs with
|
| Latest commit: |
24edeb9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://92bcca3a.chttpjs.pages.dev |
| Branch Preview URL: | https://devin-1792395988-docs-ctxcor.chttpjs.pages.dev |
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.
Summary
Fixes sigilco/cutils#29 — the
@chttp/authREADME quickstart (and every other doc snippet using the same handler idiom) failed under scriptc: an unannotatedasync (c) =>getsc: any(SC0001/SC2009), and(c: Ctx)hits SC2009 becauseCtx<P>is a generic interface. The working annotation is the runtime classHandleris typed on:(c: CtxCore).Changes:
packages/auth/README.md: quickstart handlers nowasync (c: CtxCore)withimport { CtxCore } from "@chttp/router"shown.README.md,packages/router/README.md,packages/stream/README.md,docs/{index,quickstart,middleware,deploy,html,multipart,routing,static,streaming,unplugin}.md.docs/middleware.md:import type { Ctx }→CtxCoreand all(c: Ctx)annotations updated (this exact form is the second failure in the issue).Verified: a consumer file containing the fixed quickstart compiles 100% static under
scriptc coverage(bothimport { CtxCore }andimport type { CtxCore }); the old unannotated and(c: Ctx)forms reproduce the issue's errors.pnpm docs:buildstill passes.Not touched:
examples/**sources use the same idioms but are real code with their own gates — worth a separate sweep if wanted.Link to Devin session: https://app.devin.ai/sessions/876dac2af1e84877b45fb044d31c514b
Open in Devin Desktop: https://app.devin.ai/desktop/session/876dac2af1e84877b45fb044d31c514b?variant=devin
Requested by: @espetro