File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,13 @@ export function fromEstree(estree, options = {}) {
32
32
leave ( node , field , index , parents ) {
33
33
const parent = parents [ parents . length - 1 ]
34
34
/** @type {EstreeNode } */
35
- // @ts -expect-error: indexable.
36
- const context = field === null || index === null ? parent : parent [ field ]
37
- /** @type {string | number | null } */
38
- const prop = index === null ? field : index
35
+ const context =
36
+ field === undefined || index === undefined
37
+ ? parent
38
+ : // @ts -expect-error: indexable.
39
+ parent [ field ]
40
+ /** @type {string | number | undefined } */
41
+ const prop = index === undefined ? field : index
39
42
/** @type {UnistNode } */
40
43
const copy = { }
41
44
/** @type {string } */
@@ -94,7 +97,7 @@ export function fromEstree(estree, options = {}) {
94
97
95
98
copy . position = positionFromEstree ( node )
96
99
97
- if ( prop === null ) {
100
+ if ( prop === undefined ) {
98
101
tail = copy
99
102
} else {
100
103
// @ts -expect-error: indexable.
Original file line number Diff line number Diff line change 38
38
"types" : " index.d.ts" ,
39
39
"dependencies" : {
40
40
"@types/estree-jsx" : " ^1.0.0" ,
41
- "estree-util-visit" : " ^1 .0.0" ,
42
- "unist-util-position-from-estree" : " ^1 .0.0"
41
+ "estree-util-visit" : " ^2 .0.0" ,
42
+ "unist-util-position-from-estree" : " ^2 .0.0"
43
43
},
44
44
"devDependencies" : {
45
45
"@types/node" : " ^20.0.0" ,
You can’t perform that action at this time.
0 commit comments