Using typescript typings google.visualization within a Visual Studio project

55 views
Skip to first unread message

Ryan Reynolds

unread,
Oct 27, 2017, 11:52:25 PM10/27/17
to Google Visualization API
Sorry if this is a beginner question, but what's the best way to get the typings picked up in VS for an external JS library like google charts?

Thanks in advance

Here is my current code:


import { Component, Inject } from '@angular/core';
import { JsonServiceClient } from 'servicestack-client';
import * as dto from '../../dtos/portal-services.dtos';


declare
var google: any;


@Component({
    selector
: 'operations',
    templateUrl
: './operations.component.html'
})
export class OperationsComponent {
    dashboard
: any;
    client
: JsonServiceClient;
    venueCategoryControl
: any;
    columnsChart
: any;
    proxyTable
: any;
    sharedData
: any;
    colors
: string[] = ['black', 'red', 'maroon', 'olive', 'blue', 'fuchsia'];


    constructor
(@Inject('PORTAL_SERVICE_URL') portalServiceUrl: string) {
       
this.drawDashboard = this.drawDashboard.bind(this);
       
this.client = new JsonServiceClient(portalServiceUrl);
   
}


    ngOnInit
(): void {
        console
.log('OperationsComponent init...');
        google
.charts.load('current', { 'packages': ['corechart', 'controls', 'calendar'] });
        google
.charts.setOnLoadCallback(this.drawDashboard);
   
}


Reply all
Reply to author
Forward
0 new messages