How to fix declare var error: unexpected token on typescript : <p>I'm trying to call an imported function in the JS file (see src="https://cdns.gigya.com/JS/gigya.js?apiKey=3_sVidf29tz") from the ts file by using "declare var gigya;" but I get an error: unexpected token</p>

<p>What am I missing?</p>

<p><strong>My code:</strong>
JS login.component.html</p>

<pre><code>&lt;body onload="callScreenSet()"&gt;
&lt;div id="screen-set"&gt;&lt;/div&gt;
&lt;/body&gt;
</code></pre>

<p>index.html</p>

<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;title&gt;LanguageApp&lt;/title&gt;
  &lt;base href="/"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;
  &lt;link href="/styles.css" rel="stylesheet" type="text/css"/&gt;
  &lt;script type="text/javascript" lang="javascript" src="https://cdns.gigya.com/JS/gigya.js?apiKey=3_sVidf29tz"&gt;&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;
  &lt;app-root&gt;Loading...&lt;/app-root&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>login.component.ts</p>

<pre><code>import { Component, OnInit, AfterContentInit } from '@angular/core';
import any = jasmine.any;
@Component({
  selector: 'app-root',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']  
})
    declare var gigya;
export class LoginComponent implements OnInit {  
  private _screenSet: string = 'Default-RegistrationLogin';
  private _containerID:string = 'screenSet';
  constructor(private srvLogin: LoginService) {}
  ngOnInit() {}  
  public callScreenSet():void
  {
    gigya.accounts.showScreenSet({screenSet: this._screenSet,containerID: this._containerID});
  }
}
</code></pre>

<p>package.json</p>

<pre><code>{
  "name": "language-app",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/router": "3.2.1",
    "auth0-lock": "^10.14.0",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@angular/compiler-cli": "2.2.1",
    "@types/jasmine": "2.5.38",
    "@types/lodash": "4.14.50",
    "@types/node": "^6.0.70",
    "angular-cli": "1.0.0-beta.21",
    "codelyzer": "~1.0.0-beta.3",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3",
    "webdriver-manager": "10.2.5"
  }
}
</code></pre>

<p>Thanks</p>
