Skip to content

Typescript definitions #14

@RobRendell

Description

@RobRendell

Hi! I wrote a react-multi-toggle.d.ts file to define the props of this component so Typescript can do static type-checking on the props. I thought I'd share it, to potentially be added to the module, or for the benefit of anyone who wants to yoink it from here.

declare module 'react-multi-toggle' {

    import * as React from "react";

    export interface ReactMultiToggleOption<T> {
        value: T;
        displayName?: string;
        optionClass?: string;
    }

    interface ReactMultiToggleProps<T> {
        options: ReactMultiToggleOption<T>[];
        selectedOption: T;
        onSelectOption: (value: T) => any;
        label?: any;
        className?: string;
    }

    export default class MultiToggle<T> extends React.Component<ReactMultiToggleProps<T>> {
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions