[PR #3702] [MERGED] Fix usernameValidator example return type from bool | undefined to bool #4960

Closed
opened 2026-03-13 12:05:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3702
Author: @mikelsr
Created: 7/30/2025
Status: Merged
Merged: 7/30/2025
Merged by: @Bekacru

Base: mainHead: docs/complete-username-validator-example


📝 Commits (1)

  • bff5bd2 Fix usernameValidator example return type from bool|undefined to bool

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 docs/content/docs/plugins/username.mdx (+1 -0)

📄 Description

I was playing around with the example when I came across this error with an easy fix:

Type '(username: string) => false | undefined' is not assignable to type '(username: string) => boolean | Promise<boolean>'.
  Type 'false | undefined' is not assignable to type 'boolean | Promise<boolean>'.
    Type 'undefined' is not assignable to type 'boolean | Promise<boolean>'.

I'm submitting the update so copy/pasting just works :)


Summary by cubic

Fixed the usernameValidator example to always return a boolean, preventing type errors when copying the code.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3702 **Author:** [@mikelsr](https://github.com/mikelsr) **Created:** 7/30/2025 **Status:** ✅ Merged **Merged:** 7/30/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `docs/complete-username-validator-example` --- ### 📝 Commits (1) - [`bff5bd2`](https://github.com/better-auth/better-auth/commit/bff5bd2aa501c30b65cadf48eca518cacb5853fb) Fix usernameValidator example return type from bool|undefined to bool ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/username.mdx` (+1 -0) </details> ### 📄 Description I was playing around with the example when I came across this error with an easy fix: ``` Type '(username: string) => false | undefined' is not assignable to type '(username: string) => boolean | Promise<boolean>'. Type 'false | undefined' is not assignable to type 'boolean | Promise<boolean>'. Type 'undefined' is not assignable to type 'boolean | Promise<boolean>'. ``` I'm submitting the update so copy/pasting just works :) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed the usernameValidator example to always return a boolean, preventing type errors when copying the code. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:05:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#4960