Skip to content

Commit 6742b2d

Browse files
authored
Fix TypeScript node16 and ESM
Closes GH-35. Related-to: syntax-tree/mdast-util-mdxjs-esm#3. Related-to: syntax-tree/unist-util-visit-parents#12. Reviewed-by: JounQin <admin@1stg.me> Reviewed-by: Titus Wormer <tituswormer@gmail.com>
1 parent 6789ad5 commit 6742b2d

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

complex-types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
VisitorResult,
55
Matches,
66
InclusiveDescendant
7-
} from 'unist-util-visit-parents/complex-types'
7+
} from 'unist-util-visit-parents/complex-types.js'
88

99
/**
1010
* Called when a node (matching test, if given) is found.

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @typedef {import('unist').Parent} Parent
44
* @typedef {import('unist-util-is').Test} Test
55
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
6-
* @typedef {import('./complex-types').Visitor} Visitor
6+
* @typedef {import('./complex-types.js').Visitor} Visitor
77
*/
88

99
import {visitParents} from 'unist-util-visit-parents'
@@ -23,15 +23,15 @@ import {visitParents} from 'unist-util-visit-parents'
2323
export const visit =
2424
/**
2525
* @type {(
26-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
27-
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types').BuildVisitor<Tree>, reverse?: boolean) => void)
26+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
27+
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
2828
* )}
2929
*/
3030
(
3131
/**
3232
* @param {Node} tree
3333
* @param {Test} test
34-
* @param {import('./complex-types').Visitor} visitor
34+
* @param {import('./complex-types.js').Visitor} visitor
3535
* @param {boolean} [reverse]
3636
*/
3737
function (tree, test, visitor, reverse) {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"dependencies": {
5151
"@types/unist": "^2.0.0",
5252
"unist-util-is": "^5.0.0",
53-
"unist-util-visit-parents": "^5.0.0"
53+
"unist-util-visit-parents": "^5.1.1"
5454
},
5555
"devDependencies": {
5656
"@types/tape": "^4.0.0",
@@ -63,9 +63,9 @@
6363
"remark-preset-wooorm": "^9.0.0",
6464
"rimraf": "^3.0.0",
6565
"tape": "^5.0.0",
66-
"tsd": "^0.20.0",
66+
"tsd": "^0.22.0",
6767
"type-coverage": "^2.0.0",
68-
"typescript": "^4.0.0",
68+
"typescript": "^4.7.0",
6969
"xo": "^0.49.0"
7070
},
7171
"scripts": {

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"compilerOptions": {
44
"target": "ES2020",
55
"lib": ["ES2020"],
6-
"module": "ES2020",
7-
"moduleResolution": "node",
6+
"module": "Node16",
87
"allowJs": true,
98
"checkJs": true,
109
"declaration": true,

0 commit comments

Comments
 (0)