skip to Main Content

I have a project with an entrypoint index.ts in the base folder and all the files located in src (build in dist).

When I want autocomplete or quick fix to import an existing class , it don’t show up for all the classes (some old one are there but not the newer I write).
If I do the same things on a file located in ./src it work but not in the ./index.ts

I have a FollowUserUseCase class in ./src/application/usecase/

I also have a Followee class in ./src/domain/

If I try to type "follow" then ctrl-space in ./index.ts , it don’t show up anything.

If I import manually FollowUserUseCase in index.ts, I can of course use the FollowUserUseCase class and methods and I can also create a new object of type Followee with auto import this time.

I assume its related to the path of the file I edit but how do I define that ?

My tsconfig.json :

 {
  "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"]
}

I build my project with :

"build": "tsc –build && esbuild index.ts –bundle –platform=node –format=cjs –outfile=dist/index.js"

I tried restarting vscode and ts server of course

Is this a settings in my tsconfig.ts or something else ?

2

Answers


  1. Chosen as BEST ANSWER

    okay nevermind, I removed the include setting in tsconfig and it worked fine. But I don't really understand why.


  2. The defaults for files is false, for include is [] if files is specified; **/* otherwise, and for exclude is node_modules, bower_components, jspm_packages, and outDir. If you specify include, then everything that you don’t specify in there won’t be included for IntelliSense. You can either delete your include property and take the default of **/*, or specify something like ["index.ts", "src/**/*.ts"]

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search