Skip to content

AnonymousAuth is dead code that is broken at runtime and fails check-types #1542

Closed

Description

@rajarshidattapy

Severity: Medium (blocks bun run check-types for the whole monorepo)
File: packages/ui/other/anonymous-auth.tsx

Description

The component treats every better-auth client call as if it returned raw data,
but the client returns { data, error }. Every access is therefore undefined
at runtime:

const session = await authClient.getSession()
if (!session?.session) { ... }              // always true  -> always "no session"

const res = await authClient.signIn.anonymous()
if (!res.token) throw new Error(...)        // always throws -> catch -> router.push(loginPath)

So the component can only ever do one thing: throw and redirect to /login.
The org-listing branches (orgs?.length, orgs?.map, orgs?.[0], org.slug)
are equally wrong — authClient.organization.list() returns { data, error }
too.

tsc reports 21 errors in this one file, and because @repo/ui is a dependency
of @repo/web and supermemory-mcp, bun run check-types fails at the root:

@repo/ui:check-types: other/anonymous-auth.tsx(17,18): error TS2339: Property 'session' does not exist on type 'Data<...> | Error$1<...>'
... 20 more
ERROR  run failed: command exited (2)
Failed: @repo/ui#check-types

Impact

AnonymousAuth has zero importers — grep -rn "AnonymousAuth" apps packages
matches only its own definition. It is unreferenced dead code that is
nonetheless red-lighting type checks for every consumer package.

Suggested fix

Delete packages/ui/other/anonymous-auth.tsx. If anonymous sign-in is still
wanted later, it should be rewritten against the { data, error } contract
rather than resurrected as-is.

Activity

  1. linear-code commented on Aug 19, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions