adonisjs / core

AdonisJS is a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more.
https://adonisjs.com
MIT License
17.05k stars 634 forks source link

Typescript Error #4815

Closed sn0rcha closed 5 days ago

sn0rcha commented 6 days ago

Package version

"@adonisjs/core": "^6.15.0"

Describe the bug

Typescript error when binding Logger to the context

Property 'config' is protected but type 'Logger<Config>' is not a class derived from 'Logger<Config>'

image

Reproduction repo

No response

RomainLanz commented 6 days ago

Hey @sn0rcha! 👋🏻

Could you please share a repository to reproduce your issue? I cannot replicate it with a default "slim" install.

image

sn0rcha commented 6 days ago

@RomainLanz thanks for the reply - can't really share the repo as it's private - but here's my package.json:

{
  "name": "testing",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "license": "UNLICENSED",
  "scripts": {
    "start": "node bin/server.js",
    "build": "node ace build",
    "dev": "node ace serve --watch",
    "test": "node ace test",
    "lint": "eslint .",
    "format": "prettier --write .",
    "typecheck": "tsc --noEmit"
  },
  "imports": {
    "#controllers/*": "./app/controllers/*.js",
    "#exceptions/*": "./app/exceptions/*.js",
    "#models/*": "./app/models/*.js",
    "#mails/*": "./app/mails/*.js",
    "#services/*": "./app/services/*.js",
    "#listeners/*": "./app/listeners/*.js",
    "#events/*": "./app/events/*.js",
    "#middleware/*": "./app/middleware/*.js",
    "#validators/*": "./app/validators/*.js",
    "#providers/*": "./providers/*.js",
    "#policies/*": "./app/policies/*.js",
    "#abilities/*": "./app/abilities/*.js",
    "#database/*": "./database/*.js",
    "#tests/*": "./tests/*.js",
    "#start/*": "./start/*.js",
    "#config/*": "./config/*.js",
    "#helpers/*": "./app/helpers/*.js",
    "#engines/*": "./app/engines/*.js",
    "#contracts/*": "./app/contracts/*.js"
  },
  "devDependencies": {
    "@adonisjs/assembler": "^7.8.2",
    "@adonisjs/eslint-config": "^1.3.0",
    "@adonisjs/prettier-config": "^1.4.0",
    "@adonisjs/tsconfig": "^1.4.0",
    "@japa/assert": "^3.0.0",
    "@japa/plugin-adonisjs": "^3.0.1",
    "@japa/runner": "^3.1.4",
    "@swc/core": "^1.4.8",
    "@types/async-csv": "^2.1.4",
    "@types/fs-extra": "^11.0.4",
    "@types/lodash": "^4.17.0",
    "@types/luxon": "^3.4.2",
    "@types/node": "^20.11.28",
    "@types/pdf-image": "^2.0.4",
    "@types/qrcode": "^1.5.5",
    "@vitejs/plugin-vue": "^5.1.1",
    "eslint": "^8.57.0",
    "pino-pretty": "^10.3.1",
    "prettier": "^3.3.3",
    "sass": "^1.77.8",
    "ts-node": "^10.9.2",
    "typescript": "^5.7.2",
    "vite": "^5.3.5"
  },
  "dependencies": {
    "@2toad/profanity": "^3.0.1",
    "@adonisjs/auth": "^9.2.4",
    "@adonisjs/core": "^6.15.0",
    "@adonisjs/inertia": "^1.2.3",
    "@adonisjs/limiter": "^2.3.2",
    "@adonisjs/lucid": "^21.4.0",
    "@adonisjs/mail": "^9.2.2",
    "@adonisjs/redis": "^9.1.0",
    "@adonisjs/session": "^7.5.0",
    "@adonisjs/shield": "^8.1.1",
    "@adonisjs/static": "^1.1.1",
    "@adonisjs/vite": "^3.0.0",
    "@anthropic-ai/sdk": "^0.32.1",
    "@aws-sdk/client-ses": "^3.699.0",
    "@flystorage/file-storage": "^0.1.5",
    "@flystorage/local-fs": "^0.1.7",
    "@inertiajs/vue3": "^1.2.0",
    "@node-minify/clean-css": "^8.0.6",
    "@node-minify/core": "^8.0.6",
    "@node-minify/html-minifier": "^8.0.6",
    "@node-minify/uglify-js": "^8.0.6",
    "@primevue/themes": "^4.2.3",
    "@sentry/node": "^8.40.0",
    "@sentry/profiling-node": "^8.40.0",
    "@sentry/vite-plugin": "^2.22.6",
    "@socket.io/redis-adapter": "^8.3.0",
    "@socket.io/redis-emitter": "^5.1.0",
    "@vinejs/vine": "^2.1.0",
    "ace-builds": "^1.36.5",
    "async-csv": "^2.1.3",
    "chart.js": "^4.4.3",
    "copy-to-clipboard": "^3.3.3",
    "edge.js": "^6.0.2",
    "file-type": "^19.6.0",
    "fs-extra": "^11.2.0",
    "hashids": "^2.3.0",
    "highlight.js": "^11.10.0",
    "jwt-decode": "^4.0.0",
    "lodash": "^4.17.21",
    "luxon": "^3.5.0",
    "mysql2": "^3.11.4",
    "openai": "^4.73.1",
    "pdf2pic": "^3.1.1",
    "primeflex": "^3.3.1",
    "primeicons": "^7.0.0",
    "primevue": "^4.2.3",
    "qrcode": "^1.5.3",
    "redis": "^4.7.0",
    "reflect-metadata": "^0.2.2",
    "sharp": "^0.33.5",
    "socket.io": "^4.8.1",
    "socket.io-client": "^4.8.1",
    "sri-toolbox": "^0.2.0",
    "stripe": "^17.4.0",
    "time2fa": "^1.3.0",
    "v-code-diff": "^1.13.1",
    "vue": "^3.4.34",
    "vue-diff": "^1.2.4",
    "vue-markdown-render": "^2.2.1",
    "vue3-ace-editor": "^2.2.4"
  },
  "eslintConfig": {
    "extends": "@adonisjs/eslint-config/app"
  },
  "prettier": "@adonisjs/prettier-config"
}
thetutlage commented 5 days ago

Probably a TypeScript 5.7 thing as they are known to break things with every release.

sn0rcha commented 5 days ago

hey @thetutlage it also happened with the previous version of typescript "typescript": "^5.4.2",

thetutlage commented 5 days ago

Yeah, doesn't seem to be related to TypeScript. It's because of duplicated copies of @adonisjs/logger package installed at the flat level and within the @adonisjs/core/node_modules directory.

Can you please upgrade to the latest version of AdonisJS packages and it should be solved with that. Also, make sure you are using the latest version of pino-pretty as well.

sn0rcha commented 5 days ago

@thetutlage - many thanks I ran npx npm-check-updates and upgraded core and pino-pretty - problem solved :)