mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-04 09:19:16 +02:00
fix: fix a few TS errors (#5437)
* fix errors Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix website Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Revert adding lib Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix tsconfig Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Restore previous ordering Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * exclude sw.js from typechecking * Tests: include typechecking of website * cleanup @site/ alias in TS config Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
74f060dde0
commit
df3752cc71
12 changed files with 31 additions and 36 deletions
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.5",
|
||||
"@tsconfig/docusaurus": "^1.0.3",
|
||||
"@tsconfig/docusaurus": "^1.0.4",
|
||||
"@types/react": "^17.0.14",
|
||||
"@types/react-helmet": "^6.1.2",
|
||||
"@types/react-router-dom": "^5.1.8",
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
// This file is not used in compilation. It is here just for a nice editor experience.
|
||||
"extends": "@tsconfig/docusaurus/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@site/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/"]
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||
|
|
12
packages/docusaurus-mdx-loader/src/types.d.ts
vendored
12
packages/docusaurus-mdx-loader/src/types.d.ts
vendored
|
@ -6,6 +6,9 @@
|
|||
*/
|
||||
|
||||
declare module '@docusaurus/mdx-loader' {
|
||||
type RemarkOrRehypePlugin =
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
[Function, Record<string, unknown>] | Function;
|
||||
export interface RemarkAndRehypePluginOptions {
|
||||
remarkPlugins: RemarkOrRehypePlugin[];
|
||||
rehypePlugins: string[];
|
||||
|
@ -18,7 +21,7 @@ declare module '@docusaurus/mdx-loader' {
|
|||
declare module '@mdx-js/mdx' {
|
||||
import type {Plugin, Processor} from 'unified';
|
||||
|
||||
export namespace mdx {
|
||||
namespace mdx {
|
||||
interface Options {
|
||||
filepath?: string;
|
||||
skipExport?: boolean;
|
||||
|
@ -31,8 +34,7 @@ declare module '@mdx-js/mdx' {
|
|||
function createMdxAstCompiler(options?: Options): Processor;
|
||||
function createCompiler(options?: Options): Processor;
|
||||
}
|
||||
export default function mdx(
|
||||
content: string,
|
||||
options?: mdx.Options,
|
||||
): Promise<string>;
|
||||
function mdx(content: string, options?: mdx.Options): Promise<string>;
|
||||
|
||||
export default mdx;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ declare module '@theme/BlogSidebar' {
|
|||
|
||||
declare module '@theme/BlogPostPage' {
|
||||
import type {BlogSidebar} from '@theme/BlogSidebar';
|
||||
import type {TOCItem} from '@docusaurus/types';
|
||||
|
||||
export type FrontMatter = import('./src/blogFrontMatter').BlogPostFrontMatter;
|
||||
export type Assets = import('./src/types').Assets;
|
||||
|
|
|
@ -20,22 +20,11 @@ export type ActivePlugin = {
|
|||
pluginData: GlobalPluginData;
|
||||
};
|
||||
|
||||
export type GetActivePluginOptions = {failfast?: boolean};
|
||||
export type GetActivePluginOptions = {failfast?: boolean}; // use fail-fast option if you know for sure one plugin instance is active
|
||||
|
||||
// get the data of the plugin that is currently "active"
|
||||
// ie the docs of that plugin are currently browsed
|
||||
// it is useful to support multiple docs plugin instances
|
||||
export function getActivePlugin(
|
||||
allPluginDatas: Record<string, GlobalPluginData>,
|
||||
pathname: string,
|
||||
options: {failfast: true}, // use fail-fast option if you know for sure one plugin instance is active
|
||||
): ActivePlugin;
|
||||
export function getActivePlugin(
|
||||
allPluginDatas: Record<string, GlobalPluginData>,
|
||||
pathname: string,
|
||||
options?: GetActivePluginOptions,
|
||||
): ActivePlugin | undefined;
|
||||
|
||||
export function getActivePlugin(
|
||||
allPluginDatas: Record<string, GlobalPluginData>,
|
||||
pathname: string,
|
||||
|
|
|
@ -166,6 +166,8 @@ declare module '@theme/DocPage' {
|
|||
}
|
||||
|
||||
declare module '@theme/Seo' {
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export type Props = {
|
||||
readonly title?: string;
|
||||
readonly description?: string;
|
||||
|
@ -184,15 +186,16 @@ declare module '@theme/hooks/useDocs' {
|
|||
type ActivePlugin = import('./client/docsClientUtils').ActivePlugin;
|
||||
type ActiveDocContext = import('./client/docsClientUtils').ActiveDocContext;
|
||||
type DocVersionSuggestions = import('./client/docsClientUtils').DocVersionSuggestions;
|
||||
type GetActivePluginOptions = import('./client/docsClientUtils').GetActivePluginOptions;
|
||||
|
||||
export type {GlobalPluginData, GlobalVersion};
|
||||
export const useAllDocsData: () => Record<string, GlobalPluginData>;
|
||||
export const useDocsData: (pluginId?: string) => GlobalPluginData;
|
||||
export const useActivePlugin: (
|
||||
options: GetActivePluginOptions = {},
|
||||
options?: GetActivePluginOptions,
|
||||
) => ActivePlugin | undefined;
|
||||
export const useActivePluginAndVersion: (
|
||||
options: GetActivePluginOptions = {},
|
||||
options?: GetActivePluginOptions,
|
||||
) =>
|
||||
| {activePlugin: ActivePlugin; activeVersion: GlobalVersion | undefined}
|
||||
| undefined;
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.5",
|
||||
"@types/parse-numeric-range": "^0.0.1"
|
||||
"@types/parse-numeric-range": "^0.0.1",
|
||||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.4 || ^17.0.0",
|
||||
|
|
|
@ -743,6 +743,7 @@ declare module '@theme/TagsListInline' {
|
|||
|
||||
declare module '@theme/Tag' {
|
||||
import type {TagsListItem} from '@theme/TagsListByLetter';
|
||||
import type {Optional} from 'utility-types';
|
||||
|
||||
export type Props = Optional<TagsListItem, 'count'>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue