adobe / adobe/react-spectrum

Would like useButton to be generic

Open
#2,408 0 comments 0 reactions 0 assignees View on GitHub
typescript
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

# 🙋 Feature Request

Would like `useButton` to be declared in a [_generic_](https://www.typescriptlang.org/docs/handbook/2/generics.html) manner. Benefits:
1. Slightly less code, compared to overloading
2. A little better dev experience when in VS Code where you can see the docs when hovering over the API

## 🤔 Expected Behavior
N/A

## 😯 Current Behavior
On the second point, you can't see the docs when you hover:
![image](https://user-images.githubusercontent.com/11140840/135674785-d8093052-f177-4232-9c7d-c13a71f2a19c.png)

## 💁 Possible Solution
N/A

## 🔦 Context
N/A

## 💻 Examples
`useTextField` is declared using generics. Should be possible to achieve the same with `useButton`.

## 🧢 Your Company/Team
Adobe/RSP

## 🎁 Tracking Ticket (optional)
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.