Skip to content

Commit 6cae063

Browse files
committed
Update @types/xast, utilities
1 parent f181efa commit 6cae063

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

lib/index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
/**
2-
* @typedef {import('xast').Root} Root
3-
* @typedef {import('xast').Element} Element
4-
* @typedef {import('xast').RootChildMap} RootChildMap
2+
* @typedef {import('xast').Nodes} Nodes
3+
* @typedef {import('xast').Parents} Parents
54
*/
65

7-
/**
8-
* @typedef {RootChildMap[keyof RootChildMap]} Child
9-
* @typedef {Root | Child} Node
10-
* @typedef {Root | Element} Parent
11-
*/
6+
// This lets VS Code show references to the above types.
7+
''
128

139
/**
1410
* Get the plain-text value of a node.
1511
*
16-
* @param {Node} node
12+
* @param {Nodes} node
1713
* Node to serialize.
1814
* @returns {string}
1915
* Serialized node.
@@ -27,7 +23,7 @@ export function toString(node) {
2723
/**
2824
* Serialize a child.
2925
*
30-
* @param {Node} node
26+
* @param {Nodes} node
3127
* Child to serialize.
3228
* @returns {string}
3329
* Serialized node.
@@ -41,7 +37,7 @@ function one(node) {
4137
/**
4238
* Serialize a parent.
4339
*
44-
* @param {Parent} node
40+
* @param {Parents} node
4541
* Parent to serialize.
4642
* @returns {string}
4743
* Serialized node.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"index.js"
3535
],
3636
"dependencies": {
37-
"@types/xast": "^1.0.0"
37+
"@types/xast": "^2.0.0"
3838
},
3939
"devDependencies": {
4040
"@types/node": "^20.0.0",
@@ -44,7 +44,7 @@
4444
"remark-preset-wooorm": "^9.0.0",
4545
"type-coverage": "^2.0.0",
4646
"typescript": "^5.0.0",
47-
"unist-builder": "^3.0.0",
47+
"unist-builder": "^4.0.0",
4848
"xo": "^0.55.0"
4949
},
5050
"scripts": {

test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ test('toString', () => {
3939

4040
assert.deepEqual(
4141
toString(
42-
u('element', {name: 'package'}, [
42+
u('element', {name: 'package', attributes: {}}, [
4343
u('text', 'foo '),
4444
u('comment', 'bar'),
45-
u('element', {name: 'thing'}, [u('text', ' baz')])
45+
u('element', {name: 'thing', attributes: {}}, [u('text', ' baz')])
4646
])
4747
),
4848
'foo baz',
@@ -55,7 +55,7 @@ test('toString', () => {
5555
u('doctype', {name: 'html'}),
5656
u('text', 'foo '),
5757
u('comment', 'bar'),
58-
u('element', {name: 'thing'}, [u('text', ' baz')])
58+
u('element', {name: 'thing', attributes: {}}, [u('text', ' baz')])
5959
])
6060
),
6161
'foo baz',

0 commit comments

Comments
 (0)