Skip to content

Commit 4aac0c2

Browse files
committed
Fixes
1 parent 553c6ab commit 4aac0c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ const STATES = {
1818
INIT: 'init',
1919
PENDING: 'pending',
2020
SUCCESS: 'success',
21-
};
21+
} as const;
2222

2323
const AsyncButton = React.forwardRef(
24-
<T extends React.ElementType>(
24+
<T extends React.ElementType = 'button'>(
2525
{
2626
as,
2727
errorConfig,
@@ -33,7 +33,7 @@ const AsyncButton = React.forwardRef(
3333
}: AsyncButtonProps<T>,
3434
ref: React.ForwardedRef<any>,
3535
) => {
36-
const [buttonState, setButtonState] = useState(STATES.INIT);
36+
const [buttonState, setButtonState] = useState<typeof STATES[keyof typeof STATES]>(STATES.INIT);
3737
const cancellablePromise = useRef<ReturnType<typeof makeCancellable>>();
3838
const timeout = useRef<ReturnType<typeof setTimeout>>();
3939

0 commit comments

Comments
 (0)