-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Describe the bug
When using @onmax/nuxt-better-auth in a Nuxt 4 app, Nitro route typing for auth endpoints is too generic, so client-side useFetch('/api/auth/customer/state') cannot infer a useful response shape.
Current behavior
Generated Nitro route types contain only a wildcard route:
'/api/auth/**': {
default: ...ReturnType<typeof import('.../api/auth/[...all]').default>
}And the catch-all handler type resolves to:
declare const _default: EventHandler<EventHandlerRequest, Promise<Response>>This makes endpoint-specific inference effectively unavailable for /api/auth/* consumers.
Expected behavior
At least one of the following:
- Expose endpoint-level typing for known auth routes (e.g.
/api/auth/customer/state) souseFetchcan infer return types. - Export public TS types for key route payloads (customer state, session state, etc.) so consumers can type local wrappers without guessing.
- Provide a documented helper/composable that returns typed data for these common auth endpoints.
Reproduction
- Create a Nuxt 4.3.x app with
@onmax/nuxt-better-auth. - Run
nuxi prepare. - Inspect
.nuxt/types/nitro-routes.d.tsand note'/api/auth/**'wildcard. - Use
useFetch('/api/auth/customer/state')in app code. - Observe that payload shape is not inferred (manual typing is required).
Environment
- Nuxt: 4.3.1
- Nitro: 2.13.1
@onmax/nuxt-better-auth: 0.0.2-alpha.29
Additional context
This mainly impacts DX and maintainability in app-level composables that consume auth/customer endpoints.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request