diff --git a/types/react-ga/index.d.ts b/types/react-ga/index.d.ts index 83d7a7218e..56d9715ed1 100644 --- a/types/react-ga/index.d.ts +++ b/types/react-ga/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-ga 2.1 // Project: https://github.com/react-ga/react-ga -// Definitions by: Tim Aldridge +// Definitions by: Tim Aldridge , Vasya Aksyonov // 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; diff --git a/types/react-ga/react-ga-tests.ts b/types/react-ga/react-ga-tests.ts index dbc1d0970c..9e1ba7b23b 100644 --- a/types/react-ga/react-ga-tests.ts +++ b/types/react-ga/react-ga-tests.ts @@ -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'