Skip to content

Commit

Permalink
Apply Lena Morita's suggestion to let TS infer the return type
Browse files Browse the repository at this point in the history
  • Loading branch information
kienstra committed Dec 20, 2022
1 parent 775f10b commit 1f9ff85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ import type { DropdownProps } from './types';
function useObservableState(
initialState: boolean,
onStateChange?: ( newState: boolean ) => void
): [ boolean, ( newState: boolean ) => void ] {
) {
const [ state, setState ] = useState( initialState );
return [
state,
( value ) => {
( value: boolean ) => {
setState( value );
if ( onStateChange ) {
onStateChange( value );
}
},
];
] as const;
}

function UnforwardedDropdown(
Expand Down

0 comments on commit 1f9ff85

Please sign in to comment.