0.0.3 • Published 6 months ago

@types/use-analytics v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/use-analytics

Summary

This package contains type definitions for use-analytics (https://github.com/DavidWells/analytics/tree/master/packages/use-analytics).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/use-analytics.

index.d.ts

// Type definitions for use-analytics 0.0
// Project: https://github.com/DavidWells/analytics/tree/master/packages/use-analytics
// Definitions by: Harry Cruse <https://github.com/CruseCtrl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

import * as React from 'react';
import { AnalyticsInstance } from 'analytics';

export function useAnalytics(): AnalyticsInstance;

export function useTrack(): AnalyticsInstance['track'];
export function usePage(): AnalyticsInstance['page'];
export function useIdentify(): AnalyticsInstance['identify'];

export const AnalyticsContext: React.Context<AnalyticsInstance>;

export interface AnalyticsProviderProps {
    children: React.ReactNode;
    instance: AnalyticsInstance;
}

export const AnalyticsProvider: React.ComponentType<AnalyticsProviderProps>;

export const AnalyticsConsumer: typeof AnalyticsContext.Consumer;

export interface WithAnalyticsProps {
    analytics: AnalyticsInstance;
}

export function withAnalytics<T extends WithAnalyticsProps>(
    Component: React.ComponentType<T>,
): React.ComponentType<Omit<T, 'analytics'>>;

Additional Details

Credits

These definitions were written by Harry Cruse.

0.0.1

8 months ago

0.0.3

6 months ago

0.0.2

7 months ago

0.0.0

2 years ago