Repository navigation
Conversation
Fixes voidzero-dev#567 ## Summary `AuthUser` and `AuthSession` were always Better Auth's base shapes. Fields from plugins and `user.additionalFields` exist at runtime but were missing from `c.get('user')`, `getUser()`, `requireAuth()`, and the session helpers. ## Changes - Make `AuthUser` and `AuthSession` mergeable interfaces - Generate `.void/auth.d.ts` from the app `auth.ts` (same pattern as `.void/env.d.ts`) - Wire generation into prepare and the routing plugin; remove the file when auth is off - List `auth.d.ts` in `.void/tsconfig.json` only after the file exists - Note inferred fields in the auth API docs ## Testing - Unit tests for codegen and for when `auth.d.ts` is listed in tsconfig - `prepareProject` write/delete lifecycle test - Integration `tsc` with `admin()` and `additionalFields` on `c.get`, `getUser`, `getSession`, and `requireAuth`
This branch has not been deployed
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.
Fixes #567
Summary
AuthUserandAuthSessionwere always Better Auth's base shapes. Fields from plugins anduser.additionalFieldsexist at runtime but were missing fromc.get('user'),getUser(),requireAuth(), and the session helpers.Changes
AuthUserandAuthSessionmergeable interfaces.void/auth.d.tsfrom the appauth.ts(same pattern as.void/env.d.ts)auth.d.tsin.void/tsconfig.jsononly after the file existsTesting
auth.d.tsis listed in tsconfigprepareProjectwrite/delete lifecycle testtscwithadmin()andadditionalFieldsonc.get,getUser,getSession, andrequireAuth🐸