freenowtech / freenowtech/wave
Typings of SelectList lead to unnecessary type casts
- Dominant language
- TypeScript
- Stars
- 67
- Forks
- 31
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Description
- `@freenow/wave` version: 1.30.0
### Relevant code
```tsx
{
console.log(option.value); // "value" does not exist on type unknown
}}
options={[1, 2, 3].map((item) => ({ label: item, value: item }))}
/>
```
### What was expected to happen?
Current behavior is to type `options` as `unknown[]`, and `option` arg in `onChange` callback as `unknown`.
It leads to unnecessary casting. Moreover, the shape of `option` is actually expected to be `{ label: string, value: string }`, the component won't work otherwise.
I would expect the option's type to extend `{ label: string, value: string }` and to be inferred from the list of provided options
### Reproduction
https://codesandbox.io/s/wave-playground-4537vt?file=/src/App.tsx
Contributor guide
Assessment
This issue has not been assessed yet.