Fixing react-ga .ga() signature (#20438)

* Fixing react-ga ga signature

* Adding additional overload
This commit is contained in:
Vasya Aksyonov
2017-10-27 17:23:12 -07:00
committed by Sheetal Nandi
parent 160b4e5701
commit e0c06b3b71
2 changed files with 9 additions and 2 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for react-ga 2.1
// Project: https://github.com/react-ga/react-ga
// Definitions by: Tim Aldridge <https://github.com/telshin>
// Definitions by: Tim Aldridge <https://github.com/telshin>, Vasya Aksyonov <https://github.com/outring>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface EventArgs {
@@ -54,7 +54,8 @@ export interface OutboundLinkArgs {
}
export function initialize(trackingCode: string, options?: InitializeOptions): void;
export function ga(): any;
export function ga(): (...args: any[]) => any;
export function ga(...args: any[]): any;
export function set(fieldsObject: FieldsObject): void;
export function send(fieldsObject: FieldsObject): void;
export function pageview(path: string): void;
+6
View File
@@ -63,6 +63,12 @@ describe("Testing react-ga v2.1.2", () => {
it("Able to make ga calls", () => {
ga.ga();
});
it("Able to make ga calls with any arguments", () => {
ga.ga("create", "UA-65432-1", "auto", "trackerName");
});
it("Able to make returned ga calls with any arguments", () => {
ga.ga()("create", "UA-65432-1", "auto", "trackerName");
});
it("Able to make send calls", () => {
const fieldObject: ga.FieldsObject = {
page: '/users'