waitingsong / midway-components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@mwcp/cache 报错

LBC000 opened this issue · comments

image
image

image

/ Midway Starting Missing baseUrl in compilerOptions. tsconfig-paths will be skipped

/ Midway Starting
start error: ⨯ Unable to compile TypeScript:
src/config/config.local.ts(8,16): error TS2352: Conversion of type '{ keys: string; typeorm: { dataSource: { default: { type: "mysql"; host: string; port: number; username: string; password: string; database: string; synchronize: true; logging: false; charset: string; cache: true; entityPrefix: string; entities: string[]; }; }; }; cache: { ...; }; customJwt: { ...; }; }' to type 'MidwayConfig' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type '{ keys: string; typeorm: { dataSource: { default: { type: "mysql"; host: string; port: number; username: string; password: string; database: string; synchronize: true; logging: false; charset: string; cache: true; entityPrefix: string; entities: string[]; }; }; }; cache: { ...; }; customJwt: { ...; }; }' is missing the following properties from type 'MidwayConfig': [ConfigKey.config], [ConfigKey.middlewareConfig], [ConfigKey.otlpGrpcExporterConfig], [ConfigKey.config], [ConfigKey.middlewareConfig]

src/config/config.local.ts(8,16): error TS2352: Conversion of type '{ keys: string; typeorm: { dataSource: { default: { type: "mysql"; host: string; port: number; username: string; password: string; database: string; synchronize: true; logging: false; charset: string; cache: true; entityPrefix: string; entities: string[]; }; }; }; cache: { ...; }; customJwt: { ...; }; }' to type 'MidwayConfig' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type '{ keys: string; typeorm: { dataSource: { default: { type: "mysql"; host: string; port: number; username: string; password: string; database: string; synchronize: true; logging: false; charset: string; cache: true; entityPrefix: string; entities: string[]; }; }; }; cache: { ...; }; customJwt: { ...; }; }' is missing the following properties from type 'MidwayConfig': [ConfigKey.config], [ConfigKey.middlewareConfig], [ConfigKey.otlpGrpcExporterConfig], [ConfigKey.config], [ConfigKey.middlewareConfig]

tsconfig.ts 设置 baseUrl: ".' 看看?

贴上 tsconfig.{ default | local }.ts 的代码我测试下。

另外,第二张图里面同时使用了具名导出 (export const cacheConfig) 和默认导出 (export default {}) 。应该避免这种情况。要么全部是具名,要么只有一个默认导出。

安装最新版试试
npm i @mwcp/cache@^11.3.5