Skip to content

Typescript Error when declaring a jBox tooltip as type 'Mouse' #172

@fredclausen

Description

@fredclausen

Typescript gives the following error

Argument of type '"Mouse"' is not assignable to parameter of type 'keyof jBoxOptionsMap'.

When compiling a jBox tooltip that is declared like this

const freq_tooltip = new jBox("Mouse", {

Adding the following to the jBoxOptionsMap interface (declared in jBox.d.ts) appears to rectify the issue

declare interface jBoxOptionsMap {
  Tooltip: jBox.jBoxOptions;
  Modal: jBox.jBoxOptions;
  Confirm: jBox.jBoxConfirmOptions;
  Notice: jBox.jBoxNoticeOptions;
  Image: jBox.jBoxImageOptions;
  Mouse: jBox.jBoxOptions;
}

But I'm not versed enough in either typescript or the jBox code base to know if that is a valid fix or not.

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