Skip to content

Commit 5f8b988

Browse files
committed
Refactor types to use ConstructNameMap interface
1 parent 19c16ee commit 5f8b988

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

index.d.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,29 @@ declare module 'mdast-util-from-markdown' {
9696
mdxJsxTagStack?: Tag[] | undefined
9797
}
9898
}
99+
100+
// Add custom data tracked to turn a syntax tree into markdown.
101+
declare module 'mdast-util-to-markdown' {
102+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
103+
interface ConstructNameMap {
104+
/**
105+
* Whole JSX element, in flow.
106+
*
107+
* ```markdown
108+
* > | <a />
109+
* ^^^^^
110+
* ```
111+
*/
112+
mdxJsxFlowElement: 'mdxJsxFlowElement'
113+
114+
/**
115+
* Whole JSX element, in text.
116+
*
117+
* ```markdown
118+
* > | a <b />.
119+
* ^^^^^
120+
* ```
121+
*/
122+
mdxJsxTextElement: 'mdxJsxTextElement'
123+
}
124+
}

lib/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ export function mdxJsxToMarkdown(options) {
520520
const tracker = track(safeOptions)
521521
const selfClosing =
522522
node.name && (!node.children || node.children.length === 0)
523-
// @ts-expect-error: to do: register.
524523
const exit = context.enter(node.type)
525524
let index = -1
526525
/** @type {Array<string>} */

0 commit comments

Comments
 (0)