downshift-js / downshift-js/downshift

TypeScript: have items and selectedItems as Readonly

Open
#1,030 4 comments 1 reaction 0 assignees View on GitHub
help wanted TypeScript
Dominant language
JavaScript
Stars
12.3k
Forks
936
PR merge metrics
No merged PRs in 30d

Description

- `downshift` version:
- `node` version:
- `npm` (or `yarn`) version:

**Relevant code or config**

```javascript
```

**What you did**:

**What happened**:

**Reproduction repository**:

**Problem description**:
Since we use items/selectedItems just for some logic and we do not tamper with them, we can mark them as read only in the TS interface.

**Suggested solution**:
In typings.ts for useSelect, useCombobox and useMultipleSelection, use Readonly to wrap the items type.

Contributor guide

Open the contributing guide

Research direction

Start in typings.ts and inspect the type definitions for useSelect, useCombobox, and useMultipleSelection. Confirm how items and selectedItems are currently typed, then update those exposed types to use Readonly as requested. Done means all three hook interfaces prevent mutation through their TypeScript types while retaining the existing item shapes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.