As the title says, I updated a few dependencies tonight, and now I get an error when I use the npx tsc command. It looks like something changed in Typescript and Axios will need to update accordingly, but I'm not totally sure. Can someone please let me know if Axios (or something else) is no longer compatible, or if I simply need to update something in my tsconfig?
The error is
PS C:\Projects\ModsList\express-app> npx tsc
node_modules/axios/index.d.ts:156:3 - error TS2416: Property 'status' in type 'AxiosError<T, D>' is not assignable to the same property in base type 'Error'.
Type 'string | undefined' is not assignable to type 'number | undefined'.
Type 'string' is not assignable to type 'number'.
156 status?: string;
~~~~~~
Found 1 error in node_modules/axios/index.d.ts:156
The dependencies that I updated are:
- typescript 4.6.4 => 4.7.4
- @types/node 17.0.35 => 18.0.0
- ts-node 10.8.0 => 10.8.1
My package.json
"name": "express-app",
"version": "0.4.0-dev",
"description": "",
"main": "index.js",
"scripts": {
"dev": "ts-node-dev --respawn --exit-child --watch src ./src/index.ts",
"start": "ts-node ./src/index.ts",
"startjs": "node ./dist/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@prisma/client": "^3.15.2",
"@quixo3/prisma-session-store": "^3.1.7",
"ajv": "^8.11.0",
"axios": "^0.27.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"express": "^4.18.1",
"express-session": "^1.17.2"
},
"devDependencies": {
"@types/cookie-parser": "^1.4.3",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/express-session": "^1.17.4",
"@types/node": "^18.0.0",
"prisma": "^3.15.2",
"ts-node": "^10.8.1",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.4"
}
}
and my tsconfig.json
"compilerOptions": {
"sourceMap": false,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"lib": ["ES2021"],
"esModuleInterop": true,
"target": "ES2021",
"moduleResolution": "node",
}
}
Edit: After further testing, the server starts up fine if I use ts-node. It just won't transpile with npx tsc.