AdvancedTypeScript

TypeScript Support

Add type definitions for Lynq in your TypeScript project by following these steps:

  1. Create a types directory in your project root
  2. Create a new file types/lynq.d.ts with the following content:
declare global {
  interface Window {
    lynq: {
      track(
        eventName: string,
        properties?: Record<string, string | number | boolean | null>
      ): void;
    };
  }
}
 
export {};

Once added, TypeScript will provide full type checking and autocompletion for the Lynq tracking functions.