feat: 更新版本至 0.0.55,增强类型支持,优化登录缓存相关类

This commit is contained in:
2026-02-21 02:24:07 +08:00
parent 885abd8c46
commit 15fd2d3dc8
5 changed files with 16 additions and 22 deletions

View File

@@ -38,7 +38,7 @@ type CacheLogin = {
loginUsers: CacheLoginUser[];
} & CacheLoginUser;
export type CacheStore<T = Cache> = {
export type CacheStore<T extends Cache = Cache> = {
name: string;
/**
* 缓存数据
@@ -85,15 +85,15 @@ export type CacheStore<T = Cache> = {
init(): Promise<any>;
};
export type LoginCacheStoreOpts = {
export type LoginCacheStoreOpts<T extends Cache = Cache> = {
name: string;
cache: Cache;
cache: T;
};
export class LoginCacheStore implements CacheStore<any> {
cache: Cache;
export class LoginCacheStore<T extends Cache = Cache> implements CacheStore<T> {
cache: T;
name: string;
cacheData: CacheLogin;
constructor(opts: LoginCacheStoreOpts) {
constructor(opts: LoginCacheStoreOpts<T>) {
if (!opts.cache) {
throw new Error('cache is required');
}