Skip to content

Commit

Permalink
fix(types): add missing ambiant TS declarations for .md / .mdx partia…
Browse files Browse the repository at this point in the history
…ls (#10693)
  • Loading branch information
slorber authored Nov 18, 2024
1 parent 644bc49 commit be7bace
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
16 changes: 16 additions & 0 deletions packages/docusaurus-module-type-aliases/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,22 @@ declare module '*.css' {
export default src;
}

declare module '*.md' {
import type {ComponentType} from 'react';

const ReactComponent: ComponentType<unknown>;

export default ReactComponent;
}

declare module '*.mdx' {
import type {ComponentType} from 'react';

const ReactComponent: ComponentType<unknown>;

export default ReactComponent;
}

interface Window {
docusaurus: {
prefetch: (url: string) => false | Promise<void[]>;
Expand Down
24 changes: 16 additions & 8 deletions website/_dogfooding/_pages tests/embeds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,29 @@ 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 {
return (
<Layout>
<div style={{padding: 10}}>
<Heading as="h1">Test Embeds</Heading>
<div style={{display: 'flex', flexWrap: 'wrap'}}>
<IframeWindow url="/?docusaurus-theme=light" />
<IframeWindow url="/?docusaurus-theme=dark" />
<IframeWindow url="/?docusaurus-theme=unexpected-value" />
<IframeWindow url="/" />
<IframeWindow url="https://docusaurus.io/" />
<IframeWindow url="https://tutorial.docusaurus.io/" />
</div>
<section>
<Heading as="h2">MDX Embeds</Heading>
<PagePartial />
</section>
<section>
<Heading as="h2">Iframe Embeds</Heading>
<div style={{display: 'flex', flexWrap: 'wrap'}}>
<IframeWindow url="/?docusaurus-theme=light" />
<IframeWindow url="/?docusaurus-theme=dark" />
<IframeWindow url="/?docusaurus-theme=unexpected-value" />
<IframeWindow url="/" />
<IframeWindow url="https://docusaurus.io/" />
<IframeWindow url="https://tutorial.docusaurus.io/" />
</div>
</section>
</div>
</Layout>
);
Expand Down

0 comments on commit be7bace

Please sign in to comment.