1
- import type { Literal } from 'mdast'
2
1
import type { Program } from 'estree-jsx'
2
+ import type { Literal as HastLiteral } from 'hast'
3
+ import type { Literal as MdastLiteral } from 'mdast'
3
4
4
5
export {
5
6
mdxExpressionFromMarkdown ,
@@ -10,7 +11,7 @@ export {
10
11
* MDX expression node, occurring in flow (block).
11
12
*/
12
13
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
13
- export interface MdxFlowExpression extends Literal {
14
+ export interface MdxFlowExpression extends MdastLiteral {
14
15
/**
15
16
* Node type.
16
17
*/
@@ -25,14 +26,14 @@ export interface MdxFlowExpression extends Literal {
25
26
*/
26
27
// eslint-disable-next-line @typescript-eslint/ban-types
27
28
estree ?: Program | null | undefined
28
- } & Literal [ 'data' ]
29
+ } & MdastLiteral [ 'data' ]
29
30
}
30
31
31
32
/**
32
33
* MDX expression node, occurring in text (phrasing).
33
34
*/
34
35
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
35
- export interface MdxTextExpression extends Literal {
36
+ export interface MdxTextExpression extends MdastLiteral {
36
37
/**
37
38
* Node type.
38
39
*/
@@ -47,7 +48,7 @@ export interface MdxTextExpression extends Literal {
47
48
*/
48
49
// eslint-disable-next-line @typescript-eslint/ban-types
49
50
estree ?: Program | null | undefined
50
- } & Literal [ 'data' ]
51
+ } & MdastLiteral [ 'data' ]
51
52
}
52
53
53
54
/**
@@ -62,6 +63,50 @@ export type MDXFlowExpression = MdxFlowExpression
62
63
// eslint-disable-next-line @typescript-eslint/naming-convention
63
64
export type MDXTextExpression = MdxTextExpression
64
65
66
+ /**
67
+ * MDX expression node, occurring in flow (block), for hast.
68
+ */
69
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
70
+ export interface MdxFlowExpressionHast extends HastLiteral {
71
+ /**
72
+ * Node type.
73
+ */
74
+ type : 'mdxFlowExpression'
75
+
76
+ /**
77
+ * Data.
78
+ */
79
+ data ?: {
80
+ /**
81
+ * Program node from estree.
82
+ */
83
+ // eslint-disable-next-line @typescript-eslint/ban-types
84
+ estree ?: Program | null | undefined
85
+ } & HastLiteral [ 'data' ]
86
+ }
87
+
88
+ /**
89
+ * MDX expression node, occurring in text (phrasing), for hast.
90
+ */
91
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
92
+ export interface MdxTextExpressionHast extends HastLiteral {
93
+ /**
94
+ * Node type.
95
+ */
96
+ type : 'mdxTextExpression'
97
+
98
+ /**
99
+ * Data.
100
+ */
101
+ data ?: {
102
+ /**
103
+ * Program node from estree.
104
+ */
105
+ // eslint-disable-next-line @typescript-eslint/ban-types
106
+ estree ?: Program | null | undefined
107
+ } & HastLiteral [ 'data' ]
108
+ }
109
+
65
110
// Add nodes to mdast content.
66
111
declare module 'mdast' {
67
112
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
@@ -81,28 +126,29 @@ declare module 'mdast' {
81
126
}
82
127
}
83
128
129
+ // Add nodes to hast content.
84
130
declare module 'hast' {
85
131
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
86
132
interface RootContentMap {
87
133
/**
88
134
* MDX expression node, occurring in flow (block).
89
135
*/
90
- mdxFlowExpression : MdxFlowExpression
136
+ mdxFlowExpression : MdxFlowExpressionHast
91
137
/**
92
138
* MDX expression node, occurring in text (phrasing).
93
139
*/
94
- mdxTextExpression : MdxTextExpression
140
+ mdxTextExpression : MdxTextExpressionHast
95
141
}
96
142
97
143
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
98
144
interface ElementContentMap {
99
145
/**
100
146
* MDX expression node, occurring in flow (block).
101
147
*/
102
- mdxFlowExpression : MdxFlowExpression
148
+ mdxFlowExpression : MdxFlowExpressionHast
103
149
/**
104
150
* MDX expression node, occurring in text (phrasing).
105
151
*/
106
- mdxTextExpression : MdxTextExpression
152
+ mdxTextExpression : MdxTextExpressionHast
107
153
}
108
154
}
0 commit comments