Open berton1982 opened 4 years ago
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 & { _expire?: number; _maxAge?: number }, maxAge: opts["maxAge"], data: { changed: boolean; rolling: opts["rolling"] } ): any;
Node v14 added the ?? operator which mongoose uses, updating from node v12 to node v14 solved this issue for me.
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 & { _expire?: number; _maxAge?: number },
maxAge: opts["maxAge"],
data: { changed: boolean; rolling: opts["rolling"] }
): any;
/**