title: Uncaught TypeError: i18next.init is not a function
body: <p>I'm using typescript for my project, and using i18next for internalization.</p>
  
  <p>typescript: v2.1.4</p>
  
  <p>i18next: v2.3.4</p>
  
  <p>@types/i18next: v2.3.35</p>
  
  <p>in my file:</p>
  
  <pre><code>import * as i18next from 'i18next';
  
  i18next.init({
      lng: 'en',
      resources: {
          en: {
              translation: {
                  "key": "hello world"
              }
          }
      }
  }, (err, t) =&gt; {
      // initialized and ready to go!
      const hw = i18next.t('key'); // hw = 'hello world'
  });
  </code></pre>
  
  <p>however, in browser it says:</p>
  
  <pre><code>Uncaught TypeError: i18next.init is not a function
  </code></pre>
  
  <p>if I log the i18next object, it looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/FfsVZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FfsVZ.png" alt="enter image description here"></a></p>
  
  <p>and in console</p>
  
  <pre><code>i18n.default.init
  </code></pre>
  
  <p>works well.</p>
  
  <p>If import like document </p>
  
  <pre><code>import i18next from 'i18next';
  </code></pre>
  
  <p>in visual studio code will complains:
  <a href="https://i.stack.imgur.com/3BXCa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3BXCa.png" alt="enter image description here"></a></p>
  
  <p>my .tsconfig</p>
  
  <pre><code>{
      "compileOnSave": true,
      "compilerOptions": {
          "removeComments": false,
          "baseUrl": "./src",
          "target": "es6",
          "moduleResolution": "node",
          "experimentalDecorators": true,
          "emitDecoratorMetadata": true,
          "noImplicitAny": true,
          "strictNullChecks": true,
          "jsx": "preserve",
          "lib": [
              "es2017",
              "dom"
          ],
          "typeRoots": [
              "./node_modules/@types"
          ],
          "types": [
              "node",
              "poly2tri",
              "three",
              "i18next"
          ]
      }
  }
  </code></pre>
  
  <p>my webpack.config.js is just too long to read.</p>
  
  <p>I wonder is something relate to the document: <a href="http://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-class-d-ts.html" rel="nofollow noreferrer">http://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-class-d-ts.html</a></p>
  
  <pre><code>/*~ Note that ES6 modules cannot directly export class objects.
   *~ This file should be imported using the CommonJS-style:
   *~   import x = require('someLibrary');
   *~
   *~ Refer to the documentation to understand common
   *~ workarounds for this limitation of ES6 modules.
   */
  </code></pre>