Skip to content

Commit

Permalink
typing quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Feb 9, 2021
1 parent 1b547eb commit a5a1226
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion packages/docusaurus-theme-classic/src/theme/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ function Navbar(): JSX.Element {
<div className="menu">
<ul className="menu__list">
{items.map((item, i) => (
<NavbarItem mobile {...item} onClick={hideSidebar} key={i} />
<NavbarItem
mobile
{...(item as any)} // TODO fix typing
onClick={hideSidebar}
key={i}
/>
))}
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions packages/docusaurus-theme-classic/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ declare module '@theme/NavbarItem/DefaultNavbarItem' {
}

declare module '@theme/NavbarItem/SearchNavbarItem' {
import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';

export type Props = DefaultNavbarItemProps;
export type Props = {readonly mobile?: boolean};

const SearchNavbarItem: (props: Props) => JSX.Element;
export default SearchNavbarItem;
Expand Down Expand Up @@ -375,13 +373,15 @@ declare module '@theme/NavbarItem' {
import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
import type {Props as DocsVersionDropdownNavbarItemProps} from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
import type {Props as DocsVersionNavbarItemProps} from '@theme/NavbarItem/DocsVersionNavbarItem';
import type {Props as SearchNavbarItemProps} from '@theme/NavbarItem/SearchNavbarItem';

export type Props =
| ({readonly type?: 'default' | undefined} & DefaultNavbarItemProps)
| ({
readonly type: 'docsVersionDropdown';
} & DocsVersionDropdownNavbarItemProps)
| ({readonly type: 'docsVersion'} & DocsVersionNavbarItemProps);
| ({readonly type: 'docsVersion'} & DocsVersionNavbarItemProps)
| ({readonly type: 'search'} & SearchNavbarItemProps);

const NavbarItem: (props: Props) => JSX.Element;
export default NavbarItem;
Expand Down

0 comments on commit a5a1226

Please sign in to comment.