2
2
* @typedef {import('estree-jsx').Program } Program
3
3
* @typedef {import('estree-jsx').Comment } Comment
4
4
* @typedef {import('estree-jsx').Node } Node
5
+ * @typedef {import('./index.js').Node } HastNode
5
6
*/
6
7
7
8
import test from 'tape'
@@ -28,6 +29,7 @@ import {toEstree} from './index.js'
28
29
// @ts -expect-error Types are wrong.
29
30
const generate = fauxEsmGenerate . default
30
31
32
+ /** @type {['mdxFlowExpression', 'mdxJsxFlowElement', 'mdxJsxTextElement', 'mdxTextExpression', 'mdxjsEsm'] } */
31
33
const passThrough = [
32
34
'mdxFlowExpression' ,
33
35
'mdxJsxFlowElement' ,
@@ -866,18 +868,17 @@ test('integration (micromark-extension-mdxjs, mdast-util-mdx)', (t) => {
866
868
867
869
const hast = toHast ( mdast , { passThrough} )
868
870
869
- if ( clean ) visit ( hast , passThrough , acornClean )
871
+ if ( clean && hast ) visit ( hast , passThrough , acornClean )
870
872
871
873
// @ts -expect-error: update.
872
874
return recastSerialize ( toEstree ( hast ) )
873
875
874
876
/**
875
- * @param {unknown } node
877
+ * @param {HastNode } node
876
878
*/
877
879
function acornClean ( node ) {
878
880
let index = - 1
879
881
880
- // @ts -expect-error embedded mdx
881
882
if ( node . data && node . data . estree ) delete node . data . estree
882
883
883
884
// @ts -expect-error embedded mdx
0 commit comments