修复一部分类型错误,无影响

This commit is contained in:
sijinhui
2024-09-30 17:48:14 +08:00
parent bf457c6853
commit 7c7cc91c05
8 changed files with 86 additions and 52 deletions

45
lib/types/next-auth.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
// types/next-auth.d.ts
import { DefaultSession, DefaultUser } from "next-auth";
declare module "next-auth" {
/**
* 扩展 Session 接口,添加自定义的用户属性
*/
interface Session {
user: {
id: string;
username?: string | null;
hasPassword?: boolean | null;
isAdmin?: boolean | null;
} & DefaultSession["user"];
}
/**
* 扩展 User 接口,添加自定义属性
* 注意:保持属性可选,以与 AdapterUser 兼容
*/
interface User extends DefaultUser {
id: string;
username?: string;
gh_username?: string;
password?: string;
isAdmin?: boolean;
}
}
declare module "next-auth/jwt" {
/**
* 扩展 JWT 接口,添加自定义的用户属性
*/
interface JWT {
user?: {
id: string;
username?: string | null;
gh_username?: string | null;
password?: string | null;
isAdmin?: boolean | null;
};
}
}