Skip to content

Commit d4804dc

Browse files
committed
chore(react-aria): improve internal typings
1 parent 81191d9 commit d4804dc

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "chore(react-aria): improve internal typings",
4+
"packageName": "@fluentui/react-aria",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-aria/src/hooks/useARIAButton/useARIAButtonProps.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Enter, Space } from '@fluentui/keyboard-keys';
22
import { useEventCallback } from '@fluentui/react-utilities';
3-
import type { ARIAButtonProps, ARIAButtonResultProps, ARIAButtonType } from './types';
3+
import * as React from 'react';
4+
import type { ARIAButtonElementIntersection, ARIAButtonProps, ARIAButtonResultProps, ARIAButtonType } from './types';
45

56
/**
67
* @internal
@@ -48,7 +49,7 @@ export function useARIAButtonProps<Type extends ARIAButtonType, Props extends AR
4849

4950
const isDisabled = disabled || disabledFocusable || normalizedARIADisabled;
5051

51-
const handleClick: Props['onClick'] = useEventCallback(ev => {
52+
const handleClick = useEventCallback((ev: React.MouseEvent<ARIAButtonElementIntersection>) => {
5253
if (isDisabled) {
5354
ev.preventDefault();
5455
ev.stopPropagation();
@@ -57,7 +58,7 @@ export function useARIAButtonProps<Type extends ARIAButtonType, Props extends AR
5758
}
5859
});
5960

60-
const handleKeyDown: Props['onKeyDown'] = useEventCallback(ev => {
61+
const handleKeyDown = useEventCallback((ev: React.KeyboardEvent<ARIAButtonElementIntersection>) => {
6162
onKeyDown?.(ev);
6263

6364
if (ev.isDefaultPrevented()) {
@@ -84,7 +85,7 @@ export function useARIAButtonProps<Type extends ARIAButtonType, Props extends AR
8485
}
8586
});
8687

87-
const handleKeyUp: Props['onKeyUp'] = useEventCallback(ev => {
88+
const handleKeyUp = useEventCallback((ev: React.KeyboardEvent<ARIAButtonElementIntersection>) => {
8889
onKeyUp?.(ev);
8990

9091
if (ev.isDefaultPrevented()) {

0 commit comments

Comments
 (0)