mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-29 13:43:03 +00:00
fix type in CustomEmojiService 2
This commit is contained in:
parent
6ea057f8f8
commit
3ff5a5ae29
2 changed files with 3 additions and 2 deletions
|
@ -13,6 +13,7 @@ import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js';
|
|||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { query } from '@/misc/prelude/url.js';
|
||||
import { Serialized } from '@/server/api/stream/types';
|
||||
|
||||
@Injectable()
|
||||
export class CustomEmojiService {
|
||||
|
@ -46,7 +47,7 @@ export class CustomEmojiService {
|
|||
toRedisConverter: (value) => JSON.stringify(Array.from(value.values())),
|
||||
fromRedisConverter: (value) => {
|
||||
if (!Array.isArray(JSON.parse(value))) return undefined; // 古いバージョンの壊れたキャッシュが残っていることがある(そのうち消す)
|
||||
return new Map(JSON.parse(value).map((x: Emoji) => [x.name, {
|
||||
return new Map(JSON.parse(value).map((x: Serialized<Emoji>) => [x.name, {
|
||||
...x,
|
||||
updatedAt: x.updatedAt && new Date(x.updatedAt),
|
||||
}]));
|
||||
|
|
|
@ -172,7 +172,7 @@ type EventUnionFromDictionary<
|
|||
> = U[keyof U];
|
||||
|
||||
// redis通すとDateのインスタンスはstringに変換されるので
|
||||
type Serialized<T> = {
|
||||
export type Serialized<T> = {
|
||||
[K in keyof T]:
|
||||
T[K] extends Date
|
||||
? string
|
||||
|
|
Loading…
Reference in a new issue