title: How to Call Typescript Function From Index.html?
body: <p>I've got an input element which tries calling a typescript function during the onchange event. However it doesn't work and I get the following error: <code>inputChange is not defined</code>.
  In my main.ts file, I've got a simple function called inputChange which just console logs &quot;Hello World!&quot;.</p>
  <pre><code>// index.html    
  &lt;input onchange=&quot;inputChange()&quot;/&gt;
  
  // main.ts
  function inputChange(){
      console.log('Hello World!')
  }
  </code></pre>
  <p>Does anyone know how I can access functions like inputChange from my index.html file? (Also everything else in my main.ts file works as normal but for some reason I can't access typescript functions/variables from index.html)</p>
  <p>I'm using webpack and babel to compile the typescript file into a bundle.js which is then appended into my index.html file by HTMLWebpackPlugin.</p>
  <p>This is my tsconfig file:</p>
  <pre><code>{
      &quot;compilerOptions&quot;: {
  
          /* Basic Options */
          &quot;target&quot;: &quot;es5&quot;,                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
          &quot;module&quot;: &quot;commonjs&quot;,                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
          &quot;lib&quot;: [&quot;es6&quot;,&quot;dom&quot;],                             /* Specify library files to be included in the compilation. */
          &quot;allowJs&quot;: false,                       /* Allow javascript files to be compiled. */
          &quot;sourceMap&quot;: true,                     /* Generates corresponding '.map' file. */
  
          /* Strict Type-Checking Options */
          &quot;strict&quot;: true,                           /* Enable all strict type-checking options. */
          &quot;noImplicitAny&quot;: true,                 /* Raise error on expressions and declarations with an implied 'any' type. */
          &quot;strictNullChecks&quot;: true,              /* Enable strict null checks. */
          &quot;strictFunctionTypes&quot;: true,           /* Enable strict checking of function types. */
          &quot;strictBindCallApply&quot;: true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
          &quot;strictPropertyInitialization&quot;: true,  /* Enable strict checking of property initialization in classes. */
          &quot;noImplicitThis&quot;: true,                /* Raise error on 'this' expressions with an implied 'any' type. */
          &quot;alwaysStrict&quot;: true,                  /* Parse in strict mode and emit &quot;use strict&quot; for each source file. */
  
          /* Additional Checks */
          &quot;noUnusedLocals&quot;: false,          /* annoying when just testing */                // &quot;noUnusedLocals&quot;: false,                /* Report errors on unused locals. */
          &quot;noUnusedParameters&quot;: false,      /* annoying when just testing */                 // &quot;noUnusedParameters&quot;: true,            /* Report errors on unused parameters. */
          &quot;noImplicitReturns&quot;: true,             /* Report error when not all code paths in function return a value. */
          &quot;noFallthroughCasesInSwitch&quot;: true,    /* Report errors for fallthrough cases in switch statement. */
  
          /* Module Resolution Options */
          &quot;allowSyntheticDefaultImports&quot;: true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
          &quot;esModuleInterop&quot;: true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
  
          /* Advanced Options */
          &quot;skipLibCheck&quot;: true,                     /* Skip type checking of declaration files. */
          &quot;forceConsistentCasingInFileNames&quot;: true  /* Disallow inconsistently-cased references to the same file. */
      },
      &quot;compileOnSave&quot;: true,
      &quot;exclude&quot;: [&quot;node_modules&quot;],
      &quot;include&quot;: [&quot;./public&quot;]
  }
  </code></pre>