Skip to content

Commit e74e68a

Browse files
committed
Add typed data registries for nodes
1 parent d38a3e3 commit e74e68a

File tree

1 file changed

+50
-30
lines changed

1 file changed

+50
-30
lines changed

index.d.ts

+50-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {Program} from 'estree-jsx'
2-
import type {Literal as HastLiteral} from 'hast'
3-
import type {Literal as MdastLiteral} from 'mdast'
2+
import type {Data as HastData, Literal as HastLiteral} from 'hast'
3+
import type {Data as MdastData, Literal as MdastLiteral} from 'mdast'
44

55
export {
66
mdxExpressionFromMarkdown,
@@ -17,14 +17,19 @@ export interface MdxFlowExpression extends MdastLiteral {
1717
type: 'mdxFlowExpression'
1818

1919
/**
20-
* Data.
20+
* Data associated with the mdast MDX expression (flow).
2121
*/
22-
data?: {
23-
/**
24-
* Program node from estree.
25-
*/
26-
estree?: Program | null | undefined
27-
} & MdastLiteral['data']
22+
data?: MdxFlowExpressionData | undefined
23+
}
24+
25+
/**
26+
* Info associated with mdast MDX expression (flow) nodes by the ecosystem.
27+
*/
28+
export interface MdxFlowExpressionData extends MdastData {
29+
/**
30+
* Program node from estree.
31+
*/
32+
estree?: Program | null | undefined
2833
}
2934

3035
/**
@@ -37,14 +42,19 @@ export interface MdxTextExpression extends MdastLiteral {
3742
type: 'mdxTextExpression'
3843

3944
/**
40-
* Data.
45+
* Data associated with the mdast MDX expression (text).
4146
*/
42-
data?: {
43-
/**
44-
* Program node from estree.
45-
*/
46-
estree?: Program | null | undefined
47-
} & MdastLiteral['data']
47+
data?: MdxTextExpressionData | undefined
48+
}
49+
50+
/**
51+
* Info associated with mdast MDX expression (text) nodes by the ecosystem.
52+
*/
53+
export interface MdxTextExpressionData extends MdastData {
54+
/**
55+
* Program node from estree.
56+
*/
57+
estree?: Program | null | undefined
4858
}
4959

5060
/**
@@ -57,14 +67,19 @@ export interface MdxFlowExpressionHast extends HastLiteral {
5767
type: 'mdxFlowExpression'
5868

5969
/**
60-
* Data.
70+
* Data associated with the hast MDX expression (flow).
6171
*/
62-
data?: {
63-
/**
64-
* Program node from estree.
65-
*/
66-
estree?: Program | null | undefined
67-
} & HastLiteral['data']
72+
data?: MdxFlowExpressionHastData | undefined
73+
}
74+
75+
/**
76+
* Info associated with hast MDX expression (flow) nodes by the ecosystem.
77+
*/
78+
export interface MdxFlowExpressionHastData extends HastData {
79+
/**
80+
* Program node from estree.
81+
*/
82+
estree?: Program | null | undefined
6883
}
6984

7085
/**
@@ -77,14 +92,19 @@ export interface MdxTextExpressionHast extends HastLiteral {
7792
type: 'mdxTextExpression'
7893

7994
/**
80-
* Data.
95+
* Data associated with the hast MDX expression (text).
8196
*/
82-
data?: {
83-
/**
84-
* Program node from estree.
85-
*/
86-
estree?: Program | null | undefined
87-
} & HastLiteral['data']
97+
data?: MdxTextExpressionHastData | undefined
98+
}
99+
100+
/**
101+
* Info associated with hast MDX expression (text) nodes by the ecosystem.
102+
*/
103+
export interface MdxTextExpressionHastData extends HastData {
104+
/**
105+
* Program node from estree.
106+
*/
107+
estree?: Program | null | undefined
88108
}
89109

90110
// Add nodes to mdast content.

0 commit comments

Comments
 (0)