I've been troubleshooting this for a week now and I'm baffled. The crazy part is that this app has been compiling just fine for months and this seems to have just happened spontaneously without changing anything that should have affected this. Come to think of it, I upgraded from WSL to WSL2 and that is roughly the time this started, possibly a coincidence.
Project Structure
/server
⚙tsconfig.json
/dist
server.js
/api
/v1
index.js
/accountDataFunctions
duplicates.js
notations.js
...
/sqlQueryGeneration
selectQuery.js
updateQuery.js
/src
server.ts
/api
/v1
index.ts
/accountDataFunctions
duplicates.ts
notations.ts
...
/sqlQueryGeneration
selectQuery.ts
updateQuery.ts
tsconfig.json
// ⚙tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"resolveJsonModule": true,
"removeComments": true,
"strict": false,
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipLibCheck": true,⭐
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
// "watch": true
},
"exclude": [
"node_modules"
],
"include": [
"src"
],
"watchOptions": {
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicPriority"
}
}
tsc --showFiles
//30x files in this directory (type definitions):
/home/surface/.nvm/versions/node/v14.15.4/lib/node_modules/typescript/lib/lib.es6.d.ts
//20x files in this directory (type definitions):
/mnt/c/Dev/Projects/debtportfol/server/node_modules/@types/node/globals.d.ts
// (this is actually my project root directory)
/mnt/c/Dev/Projects/debtportfol/
//50x files in this directory which are about 35 correct files, and 15 type definitions:
io/server/src/api/v1/generalFunctions/getDateAndTime.ts
/mnt/c/Dev/Projects/debtportfol/server/src/api/v1/generalFunctions/columns.ts
/mnt/c/Dev/Projects/debtportfol/server/node_modules/axios/index.d.ts
/mnt/c/Dev/Projects/debtportfol/server/node_modules/@types/long/index.d.ts
I've read through the official TS docs, I've tried uninstalling and reinstalling, tinkering with the include/exclude statements for hours. I genuinely can't figure out why this just happened seemingly out of the blue.
I've also noticed that the --watch flag
seems to have stopped working as well. Again, I've been working on this app for 9 months and none of this has ever been an issue before.
{
"main": "server.js",
"scripts": {
"serve": "tsc && concurrently \"tsc --watch\" \"nodemon dist/server.js\"",
"start": "tsc && node dist/server.js",
"startNormal": "node dist/server.js",
"devstart": "nodemon run dist/server.js",
"build": "tsc"
},
"dependencies": {
"@stripe/stripe-js": "^1.9.0",
...
"uuid": "^8.3.0"
},
"devDependencies": {
"@types/axios": "^0.14.0",
...
"concurrently": "^5.3.0",
"nodemon": "^2.0.3",
"typescript": "^4.2.3"
}
}