mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
refactor: move exported type definitions to declaration file (#6300)
* refactor: move exported type definitions to declaration file * fix * fix
This commit is contained in:
parent
9c0e659a44
commit
cf265c051e
53 changed files with 482 additions and 452 deletions
|
@ -36,7 +36,8 @@
|
|||
"clsx": "^1.1.1",
|
||||
"eta": "^1.12.3",
|
||||
"lodash": "^4.17.20",
|
||||
"tslib": "^2.3.1"
|
||||
"tslib": "^2.3.1",
|
||||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.14",
|
||||
|
|
|
@ -5,6 +5,22 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
declare module '@docusaurus/theme-search-algolia' {
|
||||
import type {DeepPartial} from 'utility-types';
|
||||
|
||||
export type ThemeConfig = {
|
||||
algolia: {
|
||||
contextualSearch: boolean;
|
||||
externalUrlRegex?: string;
|
||||
appId: string;
|
||||
apiKey: string;
|
||||
indexName: string;
|
||||
searchParameters: Record<string, unknown>;
|
||||
};
|
||||
};
|
||||
export type UserThemeConfig = DeepPartial<ThemeConfig>;
|
||||
}
|
||||
|
||||
declare module '@docusaurus/theme-search-algolia/client' {
|
||||
export function useAlgoliaContextualFacetFilters(): [string, string[]];
|
||||
}
|
||||
|
@ -14,17 +30,6 @@ declare module '@theme/SearchPage' {
|
|||
export default SearchPage;
|
||||
}
|
||||
|
||||
declare module '@theme/SearchMetadata' {
|
||||
export type SearchMetadataProps = {
|
||||
readonly locale?: string;
|
||||
readonly version?: string;
|
||||
readonly tag?: string;
|
||||
};
|
||||
|
||||
const SearchMetadata: (props: SearchMetadataProps) => JSX.Element;
|
||||
export default SearchMetadata;
|
||||
}
|
||||
|
||||
declare module '@theme/SearchBar' {
|
||||
const SearchBar: () => JSX.Element;
|
||||
export default SearchBar;
|
||||
|
|
|
@ -8,14 +8,10 @@
|
|||
import React from 'react';
|
||||
|
||||
import Head from '@docusaurus/Head';
|
||||
import type {SearchMetadataProps} from '@theme/SearchMetadata';
|
||||
import type {Props} from '@theme/SearchMetadata';
|
||||
|
||||
// Override default/agnostic SearchMetas to use Algolia-specific metadata
|
||||
function SearchMetadata({
|
||||
locale,
|
||||
version,
|
||||
tag,
|
||||
}: SearchMetadataProps): JSX.Element {
|
||||
function SearchMetadata({locale, version, tag}: Props): JSX.Element {
|
||||
// Seems safe to consider here the locale is the language,
|
||||
// as the existing docsearch:language filter is afaik a regular string-based filter
|
||||
const language = locale;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue