Trying to include @typegoose/typegoose
, followed all installation step for it and just put model which has been provided in example
import { prop, getModelForClass } from '@typegoose/typegoose';
class User {
@prop()
public name?: string;
}
const UserModel = getModelForClass(User);
IDEA couldn't recognize methods from UserModel
like 'create' etc.
What's more interesting - just put in empty folder the same package.json
and tsconfig.json
and put in index this code:
import { prop, getModelForClass } from '@typegoose/typegoose';
import * as mongoose from 'mongoose';
class User {
@prop()
public name?: string;
@prop({ type: () => [String] })
public jobs?: string[];
}
const UserModel = getModelForClass(User);
and IDEA see what's needed
question from:
https://stackoverflow.com/questions/65617228/idea-doesnt-recognize-typegoose-type-of-model 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…