mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
feat(v2): Provide type definitions for MDXPage from page plugin (#3354)
This commit is contained in:
parent
56c04c7834
commit
c8d6e418ff
4 changed files with 29 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
|||
"version": "2.0.0-alpha.61",
|
||||
"description": "Pages content plugin for Docusaurus",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/plugin-content-pages.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"watch": "tsc --watch"
|
||||
|
|
25
packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts
vendored
Normal file
25
packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
declare module '@theme/MDXPage' {
|
||||
import type {MarkdownRightTableOfContents} from '@docusaurus/types';
|
||||
|
||||
export type Props = {
|
||||
readonly content: {
|
||||
readonly frontMatter: {
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
};
|
||||
readonly metadata: {readonly permalink: string};
|
||||
readonly rightToc: readonly MarkdownRightTableOfContents[];
|
||||
(): JSX.Element;
|
||||
};
|
||||
};
|
||||
|
||||
const MDXPage: (props: Props) => JSX.Element;
|
||||
export default MDXPage;
|
||||
}
|
|
@ -9,8 +9,9 @@ import React from 'react';
|
|||
import Layout from '@theme/Layout';
|
||||
import {MDXProvider} from '@mdx-js/react';
|
||||
import MDXComponents from '@theme/MDXComponents';
|
||||
import type {Props} from '@theme/MDXPage';
|
||||
|
||||
function MDXPage(props) {
|
||||
function MDXPage(props: Props): JSX.Element {
|
||||
const {content: MDXPageContent} = props;
|
||||
const {frontMatter, metadata} = MDXPageContent;
|
||||
const {title, description} = frontMatter;
|
|
@ -10,6 +10,7 @@
|
|||
/// <reference types="@docusaurus/module-type-aliases" />
|
||||
/// <reference types="@docusaurus/plugin-content-blog" />
|
||||
/// <reference types="@docusaurus/plugin-content-docs" />
|
||||
/// <reference types="@docusaurus/plugin-content-pages" />
|
||||
|
||||
declare module '@theme/AnnouncementBar' {
|
||||
const AnnouncementBar: () => JSX.Element | null;
|
||||
|
@ -271,8 +272,6 @@ declare module '@theme/MDXComponents' {
|
|||
export default MDXComponents;
|
||||
}
|
||||
|
||||
// TODO @theme/MDXPage
|
||||
|
||||
declare module '@theme/Navbar' {
|
||||
const Navbar: () => JSX.Element;
|
||||
export default Navbar;
|
||||
|
|
Loading…
Add table
Reference in a new issue