Mongoose TypeScrip cannot find name 'this'' when trying to compile the project

Viewed 22

I am currently doing a project with mongodb and node.js, but I have met this issue after I install mongoose version 6.6.1 and trying to compile the project.

[ ERROR ]  TypeScript: ./node_modules/mongoose/types/query.d.ts:619:29
           Cannot find name 'this'.
L618:      /** Converts this query to a customized, reusable query constructor with all arguments and options retained. */
L619:      toConstructor(): typeof this;

my code is

import { Component, Host, Prop, h, Method, State, Listen, Element } from '@stencil/core';
import state from "../../../store"
import { select, selectAll } from 'd3-selection'
import Model from 'model-js';
import { saveAs } from 'file-saver';
import mongoose from 'mongoose';
....
componentDidLoad() {

    mongoose.connect('mongodb://127.0.0.1:27017/annotation');

}

I don't know what to do now.. an anyone helps me?

(edit) My pagkage.json

{
   "name":"annotation-component",
   "version":"1.3.0",
   "description":"Stencil Component Starter",
   "main":"dist/index.cjs.js",
   "module":"dist/custom-elements/index.js",
   "es2015":"dist/esm/index.mjs",
   "es2017":"dist/esm/index.mjs",
   "types":"dist/custom-elements/index.d.ts",
   "collection":"dist/collection/collection-manifest.json",
   "collection:main":"dist/collection/index.js",
   "unpkg":"dist/my-component/my-component.esm.js",
   "files":[
      "dist/",
      "loader/"
   ],
   "scripts":{
      "build":"stencil build --docs",
      "start":"stencil build --dev --watch --serve",
      "test":"stencil test --spec --e2e",
      "test.watch":"stencil test --spec --e2e --watchAll",
      "generate":"stencil generate",
      "postinstall":"patch-package",
      "start:ssr":"node server.js"
   },
   "dependencies":{
      "@stencil/core":"2.5.2",
      "@types/sweetalert":"^2.0.4",
      "autocompleter":"^6.1.0",
      "babel-plugin-transform-remove-strict-mode":"^0.0.2",
      "cookie-parser":"^1.4.6",
      "cors":"^2.8.5",
      "d3":"^6.0.0",
      "d3-simple-slider":"^1.10.4",
      "ejs":"^3.1.6",
      "express":"^4.17.1",
      "express-back":"0.0.2",
      "express-basic-auth":"^1.2.0",
      "express-fileupload":"^1.2.1",
      "express-session":"^1.17.2",
      "file-saver":"^2.0.5",
      "html-to-image":"^1.7.0",
      "inspector":"^0.5.0",
      "is-html":"^2.0.0",
      "jquery":"^3.6.0",
      "jquery-ui":"^1.13.0",
      "jsonwebtoken":"^8.5.1",
      "lodash":"^4.17.21",
      "model-js":"^0.2.5",
      "mongoose":"^6.6.1",
      "morgan":"^1.10.0",
      "multiple-select":"^1.5.2",
      "patch-package":"^6.4.7",
      "puppeteer":"^8.0.0",
      "requirejs":"^2.3.6",
      "sweetalert2":"^11.0.18",
      "xmlhttprequest":"^1.8.0"
   },
   "license":"MIT",
   "devDependencies":{
      "@stencil/store":"^1.4.1",
      "@types/jest":"^26.0.21",
      "@types/puppeteer":"^5.4.3",
      "jest":"^26.6.3",
      "jest-cli":"^26.6.3",
      "rollup-plugin-node-polyfills":"^0.2.1",
      "stencil-store-storage":"^0.2.0"
   }
}
0 Answers
Related