koishijs / cache

Cache Service | 缓存服务

Home Page:https://cache.koishi.chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug?: 当导入 cache 之后 declare koishi Table 会让 cache Table 的类型也变成数据库的 Table

Seidko opened this issue · comments

commented

复现代码

import { Context } from 'koishi'
import type { } from '@koishijs/cache'

declare module 'koishi' {
  interface Tables {
    testTable: TestTable
  }
}

interface TestTable {
  id?: number
}

export function apply(ctx: Context) {
  const cache = ctx.cache() // 这里的类型是数据库的 Table,而不是 cache 中的 Table
}

export const using = ['database', '__cache__'] as const
commented

declare module '@koishijs/cache'


Generated by koishi-plugin-github.

commented

是的,但是这里的问题是
image

commented

2.0.0-alpha.0 版本已经解决此问题(因为删掉了相关 API)。