feat: 更新版本至 0.0.55,增强类型支持,优化登录缓存相关类
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user