Win 10 Pro 64位
WebStorm:2018.2.3
错误:
在我的interfaces.ts文件中:
declare global {
interface Window {
dataLayer?: Array<any>;
gtag?: (...args) => void;
ga?: (action: string, type: string, data: Object) => void;
}
}
答案 0 :(得分:0)
您可以执行以下操作:
const eventName = 'event';
const handlerName= doAction;
const target = ( <any>window ); // <===== THIS IS THE WORK AROUND
target.ga && target.ga(eventName, handlerName)