REST-API-Tutorial
REST-API-Tutorial copied to clipboard
Object is of type 'unknown'. error
{ "version": "1.0.0", "main": "index.js", "scripts": { "dev": "nodemon --config nodemon.json source/app.ts" }, "license": "MIT", "dependencies": { "bcrypt": "^5.0.1", "config": "^3.3.6", "cors": "^2.8.5", "dayjs": "^1.10.6", "express": "^4.17.1", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.21", "mongoose": "^6.0.2", "nanoid": "^3.1.25", "pino": "^6.13.1", "pino-pretty": "^6.0.0", "yup": "^0.32.9" }, "devDependencies": { "@types/bcrypt": "^5.0.0", "@types/body-parser": "^1.19.1", "@types/config": "^0.0.39", "@types/cors": "^2.8.12", "@types/express": "^4.17.13", "@types/jsonwebtoken": "^8.5.5", "@types/lodash": "^4.14.172", "@types/mongoose": "^5.11.97", "@types/nanoid": "^3.0.0", "@types/node": "^16.7.5", "@types/pino": "^6.3.11", "@types/yup": "^0.29.13", "ts-node": "^10.2.1", "typescript": "^4.4.2" } }
With this package's code not run. get error source/controller/user.controller.ts:12:33 - error TS2571: Object is of type 'unknown'.
Please give feedback how to solve.
Try using lower version for mongoose look into example repo Package.json file
How to fix it in with "mongoose": "^6.0.2", version.