Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS error with plugins with options #168

Closed
darthf1 opened this issue Aug 12, 2021 · 0 comments
Closed

TS error with plugins with options #168

darthf1 opened this issue Aug 12, 2021 · 0 comments

Comments

@darthf1
Copy link

darthf1 commented Aug 12, 2021

Hi!

plugins in TomSettings is currently typed as plugins: any[];.

According to the docs, plugins without options can be an array of strings, but with options its an object.

The code below works, but leads to a TS error:

const _select = new TomSelect('#select', {
  plugins: {
    dropdown_input: {},
    clear_button: {
      title: 'Remove all selected options',
    },
    remove_button: {
      title: 'Remove this item',
    },
  },
})

Leads to:

TS2322: Type '{ dropdown_input: {}; clear_button: { title: string; }; remove_button: { title: string; }; }' is not assignable to type 'any[]'.   Object literal may only specify known properties, and 'dropdown_input' does not exist in type 'any[]'.

(if you remove the dropdown_input property the error moves to clear_button)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant