mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-27 21:48:41 +02:00
refactor(mdx-loader): streamline typescript usage for remark plugin types (#10651)
This commit is contained in:
parent
e32aa605ca
commit
bdf55eda22
12 changed files with 92 additions and 92 deletions
|
@ -15,7 +15,7 @@ import {
|
|||
} from './utils';
|
||||
import type {Heading, Root} from 'mdast';
|
||||
// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721
|
||||
import type {Transformer} from 'unified';
|
||||
import type {Plugin, Transformer} from 'unified';
|
||||
import type {
|
||||
MdxjsEsm,
|
||||
MdxJsxFlowElement,
|
||||
|
@ -155,7 +155,9 @@ async function collectTOCItems({
|
|||
}
|
||||
}
|
||||
|
||||
export default function plugin(options: PluginOptions = {}): Transformer<Root> {
|
||||
const plugin: Plugin<PluginOptions[], Root> = function plugin(
|
||||
options = {},
|
||||
): Transformer<Root> {
|
||||
const tocExportName = options.name || 'toc';
|
||||
|
||||
return async (root) => {
|
||||
|
@ -184,4 +186,6 @@ export default function plugin(options: PluginOptions = {}): Transformer<Root> {
|
|||
}),
|
||||
);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default plugin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue