I am using arcgis-js-api types in my angular5 application. When i try to import the types in multiple components i am getting uncaught reference error: __esri is not defined. I have included arcgis-js-api to the types array in tsconfig.app.json file. Here is my code.
  import { Component, OnInit, Input, ViewChild, ElementRef } from 
'@angular/core';
  import * as esriLoader from 'esri-loader';
  import { environment } from '../../../environments/environment';
  import Esri = __esri;
  @Component({
    selector: 'app-custom-widget',
    templateUrl: './custom-widget.component.html',
    styleUrls: ['./custom-widget.component.css']
  })
  export class CustomWidgetComponent implements OnInit {
    private _mapView: Esri.MapView;
    private _scriptOptions: any;
    @ViewChild('customWidget') widgetElement: ElementRef;
    @Input()
    set mapView(mapView: Esri.MapView) {
      if (!mapView) {
        return;
      }
      this._mapView = mapView;
      this.renderWidget();
    }
    get mapView(): Esri.MapView {
      return this._mapView;
    }
    constructor() {
      this._scriptOptions = {
        url: environment.arcgisAPIVersion
      };
    }
    ngOnInit() {
    }
    renderWidget(): void {
      esriLoader.loadModules([
        'esri/widgets/Widget'
      ], this._scriptOptions).then(([Widget]) => {
        const widgetProperties: Esri.WidgetProperties = {
          container: this.widgetElement.nativeElement
        };
        const widget: Esri.Widget = new Widget(widgetProperties);
        this._mapView.ui.add(widget, 'bottom-right');
      });
    }
  }