Skip to content

Commit

Permalink
refactor(docsearch): type initial query
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Aug 6, 2020
1 parent 960bf6e commit 57284e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/DocSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export interface DocSearchProps
export function DocSearch(props: DocSearchProps) {
const searchButtonRef = React.useRef<HTMLButtonElement>(null);
const [isOpen, setIsOpen] = React.useState(false);
const [initialQuery, setInitialQuery] = React.useState(undefined);
const [initialQuery, setInitialQuery] = React.useState<string | undefined>(
undefined
);

const onOpen = React.useCallback(() => {
setIsOpen(true);
Expand All @@ -44,7 +46,7 @@ export function DocSearch(props: DocSearchProps) {
}, [setIsOpen]);

const onInput = React.useCallback(
(event) => {
(event: KeyboardEvent) => {
setIsOpen(true);
setInitialQuery(event.key);
},
Expand Down

0 comments on commit 57284e4

Please sign in to comment.