Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): add missing ambiant TS declarations for .md / .mdx partials #10693

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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