Skip to content

Improve TS type for onResultsChange callback parameter #70

@tim-ming

Description

@tim-ming

The onResultsChange callback in src/index.d.ts has a loosely typed parameter:

onResultsChange: ({ type: string }) => void;

This should be a union type matching the MeasurementConfig types to provide better type safety:

onResultsChange: ({ type: 'download' | 'upload' | 'latency' | 'packetLoss' }) => void;

or

onResultsChange: (change: { type: MeasurementConfig['type'] }) => void;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions