diff --git a/packages/mdx/types/index.d.ts b/packages/mdx/types/index.d.ts index a64c90e0b..524c63808 100644 --- a/packages/mdx/types/index.d.ts +++ b/packages/mdx/types/index.d.ts @@ -11,6 +11,19 @@ declare namespace mdx { */ footnotes?: boolean + /** + * skip the addition of 'export default' statement when serializing + * to JSX + * @default false + */ + skipExport?: boolean + + /** + * wrap 'export default' statement with provided string when serializing + * to JSX + */ + wrapExport?: string + /** * remark plugins to transform markdown content * diff --git a/packages/mdx/types/mdx-test.ts b/packages/mdx/types/mdx-test.ts index ea4226eb8..92d118398 100644 --- a/packages/mdx/types/mdx-test.ts +++ b/packages/mdx/types/mdx-test.ts @@ -3,6 +3,8 @@ import * as mdx from '@mdx-js/mdx' mdx('# title') // $ExpectType Promise mdx('# title', {}) // $ExpectType Promise mdx('# title', {footnotes: false}) // $ExpectType Promise +mdx('# title', {skipExport: false}) // $ExpectType Promise +mdx('# title', {wrapExport: 'React.memo'}) // $ExpectType Promise mdx('# title', {rehypePlugins: [() => () => ({type: 'test'})]}) // $ExpectType Promise mdx('# title', {remarkPlugins: [() => () => ({type: 'test'})]}) // $ExpectType Promise mdx('# title', {compilers: []}) // $ExpectType Promise @@ -10,13 +12,16 @@ mdx('# title', {compilers: []}) // $ExpectType Promise mdx.sync('# title') // $ExpectType string mdx.sync('# title', {}) // $ExpectType string mdx.sync('# title', {footnotes: false}) // $ExpectType string +mdx.sync('# title', {skipExport: false}) // $ExpectType string +mdx.sync('# title', {wrapExport: 'React.memo'}) // $ExpectType string mdx.sync('# title', {rehypePlugins: [() => () => ({type: 'test'})]}) // $ExpectType string mdx.sync('# title', {remarkPlugins: [() => () => ({type: 'test'})]}) // $ExpectType string mdx.sync('# title', {compilers: []}) // $ExpectType string mdx.createMdxAstCompiler() // $ExpectType Processor -mdx.createMdxAstCompiler({}) // $ExpectType Processor mdx.createMdxAstCompiler({footnotes: false}) // $ExpectType Processor +mdx.createMdxAstCompiler({skipExport: false}) // $ExpectType Processor +mdx.createMdxAstCompiler({wrapExport: 'React.memo'}) // $ExpectType Processor mdx.createMdxAstCompiler({rehypePlugins: [() => () => ({type: 'test'})]}) // $ExpectType Processor mdx.createMdxAstCompiler({remarkPlugins: [() => () => ({type: 'test'})]}) // $ExpectType Processor mdx.createMdxAstCompiler({compilers: []}) // $ExpectType Processor