This repository was archived by the owner on Jun 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 134
plugin options #85
Comments
|
I mean for fields. eg. for mongoose-intl I have to set intl:true for fields one by one, but I can't because @prop is way too strict and does not let me do. Thanks |
I've found a way to deals with mongoose-intl :
import { PropOptionsWithValidate, prop } from 'typegoose';
export const property = (options: PropertyOptionsWithValidate & { intl?: boolean } = {}) => (target: any, key: string) => {
if(options.intl){
Reflect.defineMetadata('design:type', String, target, key);
}
prop(options)(target, key);
};
export declare type IntlString = String | string | {
[key: string]: String;
};
import { Typegoose } from 'typegoose';
export class TestSchema extends Typegoose {
@property({ intl: true })
name: IntlString;
} But this solutions does not work very well, the issue is that mongoose-intl does not provide an IntlString class (or interface) and wants the type to be String : https://github.com/alexsk/mongoose-intl/blob/master/lib/mongoose-intl.js#L35 |
@Ben305 this can be closed as "fixed" & "stale" |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
Can you help me how to define plugin related options? The prop seems very strict to me.
Thank you!
The text was updated successfully, but these errors were encountered: