koa-session-mongoose icon indicating copy to clipboard operation
koa-session-mongoose copied to clipboard

Could not find a declaration file for module 'koa-session-mongoose'

Open berton1982 opened this issue 4 years ago • 1 comments

i try to import it in a ts script. but it complains "Could not find a declaration file for module 'koa-session-mongoose'”;

i tried to add types.d.ts as follow, but wont work. please help `import { Session, opts } from "koa-session";

// import mongoose from 'mongoose'; // import * as MongooseStore from "koa-session-mongoose"; declare module "koa-session-mongoose" { interface Config { collection?: string; connection?: any; expires?: number; name?: string; } class MongooseStore { constructor(param: Config); /** * get session object by key */ get( key: string, maxAge: opts["maxAge"], data: { rolling: opts["rolling"] } ): any;

/**
 * set session object for key, with a maxAge (in ms)
 */
set(
  key: string,
  sess: Partial<Session> & { _expire?: number; _maxAge?: number },
  maxAge: opts["maxAge"],
  data: { changed: boolean; rolling: opts["rolling"] }
): any;

/**
 * destroy session for key
 */
destroy(key: string): any;

} export default MongooseStore; }`

berton1982 avatar Jan 09 '20 15:01 berton1982