Vue MDBSelect.setValue() arguments type bug


Topic: Vue MDBSelect.setValue() arguments type bug

todo pro premium priority asked 9 months ago

The argument types on MDBSelect method setValue cause build errors in Typescript if using strings for values in the select.

While it is confusing, for anyone else who runs into it, the work-around of casting the arguments as any seems to work correctly

theMDBSelect.value!.setValue("theValue" as any);

Expected behavior .setValue(request) should accept string(s) and number(s), same as option values can be.

const setValue = (request: number[] | number | string[] | string) => {

Actual behavior

.setValue only accepts number | number[]

Resources (screenshots, code snippets etc.)

MDBSelect.vueline 199 defines the value types in:

export interface Option {
  ...
  value?: string | number;

line 437 defines the setValue function as:

const setValue = (request: number[] | number) => {

Bartosz Cylwik staff answered 9 months ago

Hi! Thanks for showing us this issue. I'm adding this to our to-do list and we will fix this for the next release - unless we'll find a reason it should not be changed but I do not see one at this moment.

Best Regards!


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Vue
  • MDB Version: MDB5 4.1.1
  • Device: any
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: No
Tags