Skip to content

Typescript definition file #203

Open
@ArthurBorsboom

Description

@ArthurBorsboom

While searching for a Typescript definition file for bootstrap toggle, I have found a beginning on stackoverflow, which I have extended for my use cases. The defintion file is far from complete, however it is a nice start.

I would like to share it here, so hopefully someone can pick it up and extend it, to make it publicly available.

Filename: index.d.ts

interface BootstrapToggleOptions {
    on?: string;
    off?: string;
    onstyle?: OnOffStyle;
    offstyle?: OnOffStyle;
    size?: Size;
    width?: number;
    height?: number;
}

type BootstrapToggleMethods = "destroy" | "on" | "off" | "toggle" | "enable" | "disable";
type OnOffStyle = "default" | "primary" | "success" | "info" | "warning" | "danger";
type Size = "large" | "normal" | "small" | "mini";

interface JQuery {
    bootstrapToggle(): JQuery;
    bootstrapToggle( options?: BootstrapToggleOptions ): JQuery;
    bootstrapToggle( method?: BootstrapToggleMethods ): JQuery;
}

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