equinor / design-system

The Equinor design system
MIT License
116 stars 62 forks source link

fix: improves type safty for autocomplete when optionLabel is required #3408

Closed FredrikMWold closed 1 month ago

FredrikMWold commented 1 month ago

This pull request improves autocomplete type safety. The way it works now is that if the options are different from an array of strings then optionLabel is required. Typescript does not inform the user of this and the only feedback you get is a thrown error when you try and open the dropdown.

This PR makes it so that the optionLabel is optional if the options is an array of string, if not optionLabel becomes required.

oddvernes commented 1 month ago

Linting and tests are passing fine locally so disregard the failing github actions 👍

oddvernes commented 1 month ago

This resolves #3007