Typescript не удается скомпилировать в другой папке

#typescript

#typescript

Вопрос:

У меня эта чрезвычайно странная проблема с машинописью. Я так растерялся, в чем проблема, поэтому надеюсь, что кто-нибудь может помочь мне разобраться в этом.

Моя проблема связана только с REST API, который представляет собой обычный экспресс с mongoose, написанный на Typescript. Локально все компилируется безупречно, а также на моем сервере — сначала..

Я настраиваю развертывание из pm2, но вдруг проект больше не создается ?!? Ошибка 41: из-за того, что Arugument типа ‘A’ не может быть присвоен параметру типа ‘B’, оператор ‘<=’ не может быть применен к типам.

Те же ошибки возникают при выполнении нашего действия на github. Но ни у одного из разработчиков нет проблемы.

Единственное отличие — это папка.

Версия typescript и узла одинакова: Typescript: 4.0.2 Узел: 12.19.0

Вот нижняя часть ошибок:

 src/modules/projects/routes/project-directory.routes.ts:32:60 - error TS2345: Argument of type 'string | string[] | ParsedQs | ParsedQs[]' is not assignable to parameter of type 'string'.
  Type 'string[]' is not assignable to type 'string'.

32         ...(req.query.title) ? [projectQueries.match.title(req.query.title)] : [],
                                                              ~~~~~~~~~~~~~~~

src/modules/projects/routes/project-directory.routes.ts:33:68 - error TS2345: Argument of type 'string | string[] | ParsedQs | ParsedQs[]' is not assignable to parameter of type 'string'.
  Type 'string[]' is not assignable to type 'string'.

33         ...(req.query.organizer) ? [projectQueries.match.organizer(req.query.organizer)] : [],
                                                                      ~~~~~~~~~~~~~~~~~~~

src/modules/projects/routes/project-directory.routes.ts:61:46 - error TS2365: Operator '>' cannot be applied to types 'string | string[] | ParsedQs | ParsedQs[]' and 'number'.

61                 return req.query.distance amp;amp; req.query.distance > 10 ?
                                                ~~~~~~~~~~~~~~~~~~~~~~~

src/modules/projects/routes/project-directory.routes.ts:62:21 - error TS2365: Operator '<=' cannot be applied to types 'number' and 'string | string[] | ParsedQs | ParsedQs[]'.

62                     distance <= req.query.distance :
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/modules/member/services/subscribtion.routes.ts:24:13 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Type '{ project: { news: true; }; workinggroup: { _id: string; news: true; generalDiscussion: true; organization: false; }[]; }' is not assignable to type 'Subscriptions'.
      Object literal may only specify known properties, and 'project' does not exist in type 'Subscriptions'.

24             project: {
               ~~~~~~~~~~
25                 news: true
   ~~~~~~~~~~~~~~~~~~~~~~~~~~
26             },
   ~~~~~~~~~~~~~

  src/modules/member/member.model.ts:150:2
    150  subscribtions: Subscriptions;
         ~~~~~~~~~~~~~
    The expected type comes from property 'subscribtions' which is declared here on type 'MongooseUpdateQuery<Pick<MemberType, "_id" | "isDeleted" | "isApproved" | "oAuthProvider" | "token" | "email" | "phone" | "isActive" | "password" | "passwordVersion" | "firstname" | ... 36 more ... | "privateFields">>'
  node_modules/@types/mongoose/index.d.ts:3467:5
    3467     findByIdAndUpdate(id: any | number | string, update: UpdateQuery<T>,
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3468       options: QueryFindOneAndUpdateOptions,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3469       callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T, QueryHelpers> amp; QueryHelpers;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The last overload is declared here.

src/modules/zoom/zoom.routes.ts:10:11 - error TS2322: Type 'string | string[] | ParsedQs | ParsedQs[] | ZoomRole.Participant' is not assignable to type 'ZoomRole'.
  Type 'string' is not assignable to type 'ZoomRole'.

10     const role: ZoomRole = req.query.role ?? ZoomRole.Participant;
             ~~~~

src/modules/zoom/zoom.routes.ts:12:53 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.

12     const signature = ZoomService.generateSignature(meetingNumber, role)
                                                       ~~~~~~~~~~~~~

src/modules/plenary/plenary.routes.ts:55:5 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Type '{ questions: any; }' is not assignable to type 'PullOperator<Pick<({ questions: string[]; } amp; "member" amp; IMember amp; Document) | ({ questions: string[]; } amp; "moderator" amp; IMember amp; Document), number | "length" | ... 92 more ... | "questions">>'.
      Type '{ questions: any; }' is not assignable to type 'NotAcceptedFields<Pick<({ questions: string[]; } amp; "member" amp; IMember amp; Document) | ({ questions: string[]; } amp; "moderator" amp; IMember amp; Document), number | "length" | ... 92 more ... | "questions">, any[]>'.
        Types of property 'valueOf' are incompatible.
          Type '() => Object' is not assignable to type 'never'.

55              $pull: {
                ~~~~~

  node_modules/@types/mongodb/index.d.ts:1423:5
    1423     $pull?: PullOperator<TSchema>;
             ~~~~~
    The expected type comes from property '$pull' which is declared here on type 'MongooseUpdateQuery<Pick<({ questions: string[]; } amp; "member" amp; IMember amp; Document) | ({ questions: string[]; } amp; "moderator" amp; IMember amp; Document), number | "length" | ... 92 more ... | "questions">>'
  node_modules/@types/mongoose/index.d.ts:3467:5
    3467     findByIdAndUpdate(id: any | number | string, update: UpdateQuery<T>,
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3468       options: QueryFindOneAndUpdateOptions,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3469       callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T, QueryHelpers> amp; QueryHelpers;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The last overload is declared here.


Found 41 errors.