Skip to content

Commit

Permalink
Fix TypeScript node16 and ESM
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
alecmev committed Aug 21, 2022
1 parent 6789ad5 commit 6742b2d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion complex-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
VisitorResult,
Matches,
InclusiveDescendant
} from 'unist-util-visit-parents/complex-types'
} from 'unist-util-visit-parents/complex-types.js'

/**
* Called when a node (matching test, if given) is found.
Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @typedef {import('unist').Parent} Parent
* @typedef {import('unist-util-is').Test} Test
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
* @typedef {import('./complex-types').Visitor} Visitor
* @typedef {import('./complex-types.js').Visitor} Visitor
*/

import {visitParents} from 'unist-util-visit-parents'
Expand All @@ -23,15 +23,15 @@ import {visitParents} from 'unist-util-visit-parents'
export const visit =
/**
* @type {(
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types').BuildVisitor<Tree>, reverse?: boolean) => void)
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
* )}
*/
(
/**
* @param {Node} tree
* @param {Test} test
* @param {import('./complex-types').Visitor} visitor
* @param {import('./complex-types.js').Visitor} visitor
* @param {boolean} [reverse]
*/
function (tree, test, visitor, reverse) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-is": "^5.0.0",
"unist-util-visit-parents": "^5.0.0"
"unist-util-visit-parents": "^5.1.1"
},
"devDependencies": {
"@types/tape": "^4.0.0",
Expand All @@ -63,9 +63,9 @@
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"tsd": "^0.20.0",
"tsd": "^0.22.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"typescript": "^4.7.0",
"xo": "^0.49.0"
},
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"module": "ES2020",
"moduleResolution": "node",
"module": "Node16",
"allowJs": true,
"checkJs": true,
"declaration": true,
Expand Down

0 comments on commit 6742b2d

Please sign in to comment.