title: Why's that vscode cant autocomplete exported objects on its own, from one file in another, in nodejs? Is it a performance feature?
body: <h1>Problem</h1>
  
  <p>In my usecase, i maintain my database config/connections using <code>sequelize</code> in a separate file <code>models/index.js</code>. I <code>export</code> the database connection object(called <code>db</code>) so that other modules can connect to the database. But when I <code>require</code> the object in some other file, no auto-completions are shown for that object nor its corresponding properties.</p>
  
  <h1>Context</h1>
  
  <p>This is how my part of my <code>models/index.js</code> file looks like, which i have done like the official <a href="https://raw.githubusercontent.com/sequelize/express-example/master/models/index.js" rel="nofollow noreferrer">sequelize example</a>:-</p>
  
  <pre class="lang-js prettyprint-override"><code>const { Sequelize } = require('sequelize');
  const sequelize = new Sequelize(config);
  let db = {};
  // for each of the files `file` in a dir...dynamically do(refer above linked example for details):-
  let model = require(path.join(__dirname, file))(sequelize, Sequelize);
  db[model.name] = model; // type Sequelize.Model
  // dynamic config over
  
  // statically add
  db.sequelize = sequelize; // type Sequelize
  module.exports = db
  </code></pre>
  
  <p>This is how i have imported in another module:-</p>
  
  <pre class="lang-js prettyprint-override"><code>const db = require("./models/index.js");
  db.seq -------------------------------&gt; where i try for auto-completion
  </code></pre>
  
  <h1>Expectation</h1>
  
  <p>When i <code>require</code> my database connection object <code>db</code> in another file, it should provide auto-completion for the properties i statically assigned, like <code>db.sequelize</code> should be a completion and further <code>db.sequelize.xxx</code>, where <code>xxx</code> is the corresponding sequelize methods and properties should also be auto-completed.</p>
  
  <h1>What's the behavior now?</h1>
  
  <p>Typing <code>db.</code> doesn't show any valid auto-completions pertaining to the object <code>db</code>. Also <code>db.sequelize</code> has a type <code>any</code> for the <code>sequelize</code> part(so no further auto-completions), whereas I expected it to be <code>Sequelize</code>.</p>
  
  <h1>What I have done?</h1>
  
  <ul>
  <li>Explicitly added <code>jsdoc</code>, thinking that's the only way to make the auto-completions work, but to no use:-</li>
  </ul>
  
  <pre class="lang-js prettyprint-override"><code>/**
  * @typedef {import('sequelize').Sequelize} Sequelize
  */
  
  const { Sequelize } = require('sequelize');
  /**
   * @type {Sequelize}
   */
  const sequelize = new Sequelize(config);
  /**
   * key : string -&gt; Name of the Sequelize.Model | 'sequelize'
   * value : Either one of the Models or Sequelize object
   * @type {Object.&lt;string,(Sequelize|Sequelize.Model)&gt;}
   * @property {Sequelize} sequelize
   * @example
   * db = { User: db.User , seqeuelize : sequelize}
   */
  let db = {};
  // rest of the dynamic processing and adding Sequelize.Model to db
  db.sequelize = sequelize;
  module.exports = db
  </code></pre>
  
  <ul>
  <li>Added a <code>jsconfig.json</code> with following content, but that was also futile:-</li>
  </ul>
  
  <pre class="lang-js prettyprint-override"><code>{
    // NOTE THAT, this file resides within my src/server/ directory where all the js files exists
    // the models/index.js resides within src/server
    // I maintain another jsconfig for src/client
    "compilerOptions": {
      "module": "commonjs",
      "target": "es6",
      "allowSyntheticDefaultImports": true,
      "moduleResolution": "node",
      "experimentalDecorators":true,
      "baseUrl": ".",
      "paths": {
        "*": ["*"],
      },
    },
    "include": ["./**/*"],
  }
  </code></pre>