Using @Types in Ionic 3 / Angular 4


#1

Hello Ionic-Developers,

Its my first try using @types in an Ionic Project.

I have installed the following npm package:
https://www.npmjs.com/package/@types/heremaps

After that I used the types like below:


  ngAfterViewInit() {
    let platform = new H.service.Platform({
      app_id: 'XXXXXXXXXXXX',
      app_code: 'XXXXXXXXXXXX',
      useHTTPS: true,
      useCIT: true
    });
  }

The browser give me following exception:

image

Im developing with Visual Studio Code, there seems all elements available (defined in index.d.ts):

Need I any other includes that the browser knowing the classes?

Thanks in advance.


#2

I have solved my problem:

Its necessary to declare the H variable separately in your *.ts, where u wanna use this class.

declare var H: any;