Я получаю эту ошибку.
src\server\app\applicationProject\controllers\ProjectController.ts(707,89): error TS2345: Argument of type 'Express.User' is not assignable to parameter of type 'import("C:/Users/TPL-pc/Desktop/costcontrol/src/server/app/framework/dataaccess/mongoose/user")'.
также вот файл доступа / мангуста / файл пользователя -
import * as mongoose from 'mongoose';
import UserModel = require('../model/UserModel');
interface User extends UserModel, mongoose.Document {
}
export = User;
Пн goose версия - 5.9.1v, Nodejs -12.16v, express - 4.17.1, Angular 9 Ошибка « пользователь ». в этой строке - projectService.createProject (данные, пользователь, (ошибка, результат).
ProjectController.ts
import * as express from 'express';
import * as multiparty from 'multiparty';
//import ProjectService = require('./../services/ProjectService');
import Project = require('../dataaccess/mongoose/Project');
import Building = require('../dataaccess/mongoose/Building');
import Response = require('../interceptor/response/Response');
import CostControllException = require('../exception/CostControllException');
import CostHead = require('../dataaccess/model/project/building/CostHead');
import Rate from '../dataaccess/model/project/building/Rate';
import WorkItem from '../dataaccess/model/project/building/WorkItem';
import { ProjectService } from '../services/ProjectService';
let config = require('config');
let log4js = require('log4js');
let logger=log4js.getLogger('Project Controller');
let path = require('path');
var fs = require('fs');
import * as mongoose from 'mongoose';
class ProjectController {
private _projectService : ProjectService;
constructor() {
this._projectService = new ProjectService();
}
createProject(req: express.Request, res: express.Response, next: any): void {
try {
logger.info('Project controller create has been hit');
let data = <Project>req.body;
let user = req.user;
let projectService = new ProjectService();
projectService.createProject( data, user,(error, result) => {
if(error) {
next(error);
} else {
logger.info(' project is created ');
next(new Response(200,result));
}
});
} catch (e) {
logger.error(e);
next(new CostControllException(e.message,e.stack));
}
}