@casl/mongoose usage with typegoose? #549
Replies: 1 comment 5 replies
-
import { AccessibleRecordModel } from "@casl/mongoose";
import { getModelForClass as getModelForClassOld } from "@typegoose/typegoose";
import { AnyParamConstructor, BeAnObject, IModelOptions } from "@typegoose/typegoose/lib/types";
export const getModelForClass = <
U extends AnyParamConstructor<any>,
QueryHelpers = BeAnObject
>(
cl: U,
options: IModelOptions
): AccessibleRecordModel<InstanceType<U>, QueryHelpers> & U => {
return getModelForClassOld(cl, options) as any;
}; |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
johnsonjo4531
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use the @casl/mongoose library with typegoose any good way to go about this? I can get a reproduction up tomorrow sometime, but I'm ending my workday and just thought I would ask now rather than later on the of chance someone wants to be beyond helpful. This is what I've tried.
If I end up getting this tomorrow without help I'll try and post what I did back here.
Beta Was this translation helpful? Give feedback.
All reactions