Skip to content

Commit

Permalink
types: add createCompiler to MDX Typescript API (#1499)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihupoo authored Apr 1, 2021
1 parent d140f95 commit 5169bf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/mdx/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,20 @@ declare namespace mdx {
function sync(mdx: string, options?: Options): string

/**
* Generated an MDX compiler
* Generated an MDX AST compiler
*
* @param options transform and compiler options
* @returns Unified Processor for MDX
*/
function createMdxAstCompiler(options?: Options): Processor

/**
* Generated an MDX compiler
*
* @param options transform and compiler options
* @returns Unified Processor for MDX
*/
function createCompiler(options?: Options): Processor
}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/mdx/types/mdx-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ mdx.createMdxAstCompiler({skipExport: false}) // $ExpectType Processor<Settings>
mdx.createMdxAstCompiler({wrapExport: 'React.memo'}) // $ExpectType Processor<Settings>
mdx.createMdxAstCompiler({rehypePlugins: [() => () => ({type: 'test'})]}) // $ExpectType Processor<Settings>
mdx.createMdxAstCompiler({remarkPlugins: [() => () => ({type: 'test'})]}) // $ExpectType Processor<Settings>

mdx.createCompiler() // $ExpectType Processor<Settings>
mdx.createCompiler({skipExport: false}) // $ExpectType Processor<Settings>
mdx.createCompiler({wrapExport: 'React.memo'}) // $ExpectType Processor<Settings>
mdx.createCompiler({rehypePlugins: [() => () => ({type: 'test'})]}) // $ExpectType Processor<Settings>
mdx.createCompiler({remarkPlugins: [() => () => ({type: 'test'})]}) // $ExpectType Processor<Settings>

1 comment on commit 5169bf1

@vercel
Copy link

@vercel vercel bot commented on 5169bf1 Apr 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.