I'm currently working on a project that has an entrypoint index.ts in the main folder, with all other files located in src (which are then built in dist).
However, I've noticed that when I try to use autocomplete or quick fix to import existing classes, not all of them show up. Some older classes appear, but newer ones that I've written do not. This issue only seems to occur when editing the ./index.ts file, as it works fine when editing files within the ./src directory.
For example, I have a FollowUserUseCase
class in ./src/application/usecase/ and a Followee
class in ./src/domain/. When I attempt to type "follow" and then press ctrl-space in ./index.ts, nothing appears.
If I manually import FollowUserUseCase in index.ts, I can use the class and its methods without any issues. I can also create a new object of type Followee with auto-import this time.
I suspect that this issue is related to the path of the file I am editing, but I'm unsure how to define it correctly.
This is what my tsconfig.json looks like:
{
"compilerOptions": {
"target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"module": "CommonJS" /* Specify what module code is generated. */,
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
"strict": true /* Enable all strict type-checking options. */,
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": ["./index.ts"]
}
My project is built using:
"build": "tsc --build && esbuild index.ts --bundle --platform=node --format=cjs --outfile=dist/index.js"
I have already tried restarting vscode and the TypeScript server, but the issue persists. Is there a setting in my tsconfig.json that could be causing this problem, or could it be something else entirely?