From bb10a24b4a26bafb0ada102ba61f72c52b28882a Mon Sep 17 00:00:00 2001 From: sebastien Date: Mon, 18 Nov 2024 14:18:54 +0100 Subject: [PATCH] provide ambiant TS declarations for .md / .mdx --- .../src/index.d.ts | 16 +++++++++++++ website/_dogfooding/_pages tests/embeds.tsx | 24 ++++++++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/packages/docusaurus-module-type-aliases/src/index.d.ts b/packages/docusaurus-module-type-aliases/src/index.d.ts index 8da692e648dc..7fb78549f13d 100644 --- a/packages/docusaurus-module-type-aliases/src/index.d.ts +++ b/packages/docusaurus-module-type-aliases/src/index.d.ts @@ -389,6 +389,22 @@ declare module '*.css' { export default src; } +declare module '*.md' { + import type {ComponentType} from 'react'; + + const ReactComponent: ComponentType; + + export default ReactComponent; +} + +declare module '*.mdx' { + import type {ComponentType} from 'react'; + + const ReactComponent: ComponentType; + + export default ReactComponent; +} + interface Window { docusaurus: { prefetch: (url: string) => false | Promise; diff --git a/website/_dogfooding/_pages tests/embeds.tsx b/website/_dogfooding/_pages tests/embeds.tsx index 562e9f59dd48..da7a02b66dd6 100644 --- a/website/_dogfooding/_pages tests/embeds.tsx +++ b/website/_dogfooding/_pages tests/embeds.tsx @@ -9,6 +9,7 @@ import React from 'react'; import Layout from '@theme/Layout'; import Heading from '@theme/Heading'; import IframeWindow from '@site/src/components/BrowserWindow/IframeWindow'; +import PagePartial from './_pagePartial.mdx'; // See https://github.com/facebook/docusaurus/issues/8672 export default function Embeds(): JSX.Element { @@ -16,14 +17,21 @@ export default function Embeds(): JSX.Element {
Test Embeds -
- - - - - - -
+
+ MDX Embeds + +
+
+ Iframe Embeds +
+ + + + + + +
+
);