Repository navigation
refactor: effect/avoid-any and typescript/no-explicit-any to zero - #619
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: c0749e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
thomasfosterau
force-pushed
the
lint-avoid-any
branch
from
November 12, 2026 08:03
fe8d104 to
8f919be
Compare
Replace every explicit any with the precise type, unknown, never in contravariant positions or a constrained generic; every as-unknown-as becomes an overload, a typed seam or a counted single assertion with a SAFETY comment. Removes the rules' warn/off lines and the inline disables in Registry.ts. Part of #533, #536. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5G6PMempKsgjiV1NDcCJY
thomasfosterau
force-pushed
the
lint-avoid-any
branch
from
November 12, 2026 08:08
8f919be to
1a60ec3
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5G6PMempKsgjiV1NDcCJY # Conflicts: # src/Group.flat.test.ts # vite.config.ts
7 of 8 tasks
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
Part of #533 (
effect/avoid-any) and #536 (typescript/no-explicit-any). Follow-up for the remaining seams: #623.effect/avoid-any122 -> 0 (27as any, 95as unknown as T).typescript/no-explicit-anywasoff; enabled aterrorit reported 251 sites, now 0. Both warn/off lines are gone fromvite.config.ts(no-explicit-any stays an expliciterror, since it is outside the lint categories) and the eight inline disables inRegistry.tsare removed. No inline disables or overrides added.How:
Schema.Codec<any, string>id bounds ->Codec<unknown, string>;anyin contravariant positions ->never; erased apis -> generics /HttpApi.Top;infer _Xin conditional types;Family<..., any>-> anAnyFamilyunion. Double casts became, in order of preference: overloaded function declarations with an erased implementation signature (Resource.attributeKeys/relationshipKeys/sortable/annotate,Include.paths,Document.wire/LinkageDocument,Atomic.Operations,Assemble.toWireSafeResource,Query.bracketKeys/bracketPageKeys,conformance/core.discover, and the*AttributeFieldshelpers); a precise type (Client.decodeInputconstrained to a codec; example and testrunhelpers typed by the layer they provide plusRegistry.platformLayer); a singleas Twith a// SAFETY:comment (ApiErrorencode,Resource.make'supdateInput, the test router layers,Conformance). Tests usetoHaveProperty/ typed structural views instead ofas any.test/include-path-member-union.types.tskeeps itsany-path probe viaReturnType<typeof JSON.parse>.Function.cast count
Before this revision: about 57
cast(call sites across src, tests and examples (the first PR head). After: 11 lines (13 casts), listed below and in #623.Verification
Head
1a60ec36fb11627575b5c542849b61e8fb285f90, rebased on origin/trunk (includes #594, #615, #618, #621) afterpnpm install.pnpm install --frozen-lockfile- passvp run build- passvp check- pass (0 errors)vp run check- pass (--concurrency-limit 1; includestypecheck:distand the examples)vp run -r test:unit- pass (4010 + 73 + 56 + 50 tests)vp run docgen- passvp run test:coverage, thenfallow audit --base origin/trunk- verdictwarn(0 introduced complexity; 3 duplication groups: the already-duplicated examplesortByand two sibling Endpoint blocks whose lines changed)Lint deltas against the tree before this work (
vp lint; rules trunk fixed since then are at zero): avoid-any -122, no-explicit-any -251 (newly enabled), no-chained-type-assertions -95, require-safety-comment-for-type-assertion -223, casting-awareness -80, no-unsafe-type-assertion -106, any-unknown-in-error-context -23, prefer-option-over-null -2. One rule grows:effecttsgo/unsafe-effect-type-assertion24 -> 36 (+12), from the singleas Layer.Layer<never, never, HttpRouter.HttpRouter>router-layer assertions (11 in tests, 1 insrc/Conformance.ts) that replacedas unknown as; each has a SAFETY comment. Removing them needs typed group layers; recorded in #623.Changeset
.changeset/no-explicit-any.md- minor, marked Breaking (types), with migration notes forRegistry,Client.decodeInputand the attribute-field helpers.Notes
Remaining double-assertion seams, still
cast(...)fromeffect/Function(reasons in #623):src/Registry.ts:346(2 casts: the dynamic fold and the group layer)src/ApiError.ts:399src/Endpoint.ts:2548,src/Endpoint.ts:4439src/Resource.ts:2386,src/Resource.ts:3639,src/Resource.ts:3970src/internal/codecs.ts:131src/Endpoint.test.ts:314,src/Idempotency.test.ts:246,src/Endpoint.location.test.ts:68Other points:
ResourceHandlers.make/readOnlyreturnNoInfer<...>so theunknownrequirement channel inRegistry.HandlersForis not inferred from asatisfiescontext. The examplerunhelpers now also provideRegistry.platformLayer(previously the type system was silenced). Touchingexamples/github/handlers.tscan make fallow flag two untouched functions there (estimated coverage).🤖 Generated with Claude Code
https://claude.ai/code/session_01Y5G6PMempKsgjiV1NDcCJY