Skip to content

Commit be7bace

Browse files
authored
fix(types): add missing ambiant TS declarations for .md / .mdx partials (#10693)
1 parent 644bc49 commit be7bace

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

packages/docusaurus-module-type-aliases/src/index.d.ts

+16
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,22 @@ declare module '*.css' {
389389
export default src;
390390
}
391391

392+
declare module '*.md' {
393+
import type {ComponentType} from 'react';
394+
395+
const ReactComponent: ComponentType<unknown>;
396+
397+
export default ReactComponent;
398+
}
399+
400+
declare module '*.mdx' {
401+
import type {ComponentType} from 'react';
402+
403+
const ReactComponent: ComponentType<unknown>;
404+
405+
export default ReactComponent;
406+
}
407+
392408
interface Window {
393409
docusaurus: {
394410
prefetch: (url: string) => false | Promise<void[]>;

website/_dogfooding/_pages tests/embeds.tsx

+16-8
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,29 @@ import React from 'react';
99
import Layout from '@theme/Layout';
1010
import Heading from '@theme/Heading';
1111
import IframeWindow from '@site/src/components/BrowserWindow/IframeWindow';
12+
import PagePartial from './_pagePartial.mdx';
1213

1314
// See https://github.com/facebook/docusaurus/issues/8672
1415
export default function Embeds(): JSX.Element {
1516
return (
1617
<Layout>
1718
<div style={{padding: 10}}>
1819
<Heading as="h1">Test Embeds</Heading>
19-
<div style={{display: 'flex', flexWrap: 'wrap'}}>
20-
<IframeWindow url="/?docusaurus-theme=light" />
21-
<IframeWindow url="/?docusaurus-theme=dark" />
22-
<IframeWindow url="/?docusaurus-theme=unexpected-value" />
23-
<IframeWindow url="/" />
24-
<IframeWindow url="https://docusaurus.io/" />
25-
<IframeWindow url="https://tutorial.docusaurus.io/" />
26-
</div>
20+
<section>
21+
<Heading as="h2">MDX Embeds</Heading>
22+
<PagePartial />
23+
</section>
24+
<section>
25+
<Heading as="h2">Iframe Embeds</Heading>
26+
<div style={{display: 'flex', flexWrap: 'wrap'}}>
27+
<IframeWindow url="/?docusaurus-theme=light" />
28+
<IframeWindow url="/?docusaurus-theme=dark" />
29+
<IframeWindow url="/?docusaurus-theme=unexpected-value" />
30+
<IframeWindow url="/" />
31+
<IframeWindow url="https://docusaurus.io/" />
32+
<IframeWindow url="https://tutorial.docusaurus.io/" />
33+
</div>
34+
</section>
2735
</div>
2836
</Layout>
2937
);

0 commit comments

Comments
 (0)