Skip to content

Commit 434475e

Browse files
committed
Fix for changes in @types/unist
1 parent 202dc2c commit 434475e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @typedef {import('mdast').Link} Link
23
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
34
* @typedef {import('mdast-util-from-markdown').Transform} FromMarkdownTransform
45
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
@@ -55,7 +56,6 @@ export const gfmAutolinkLiteralToMarkdown = {
5556

5657
/** @type {FromMarkdownHandle} */
5758
function enterLiteralAutolink(token) {
58-
// @ts-expect-error: `null` is fine.
5959
this.enter({type: 'link', title: null, url: '', children: []}, token)
6060
}
6161

@@ -72,7 +72,8 @@ function exitLiteralAutolinkHttp(token) {
7272
/** @type {FromMarkdownHandle} */
7373
function exitLiteralAutolinkWww(token) {
7474
this.config.exit.data.call(this, token)
75-
this.stack[this.stack.length - 1].url = 'http://' + this.sliceSerialize(token)
75+
const node = /** @type {Link} */ (this.stack[this.stack.length - 1])
76+
node.url = 'http://' + this.sliceSerialize(token)
7677
}
7778

7879
/** @type {FromMarkdownHandle} */
@@ -130,7 +131,6 @@ function findUrl(_, protocol, domain, path, match) {
130131
if (!parts[0]) return false
131132

132133
/** @type {PhrasingContent} */
133-
// @ts-expect-error: `null` is fine.
134134
const result = {
135135
type: 'link',
136136
title: null,
@@ -160,7 +160,6 @@ function findEmail(_, atext, label, match) {
160160

161161
return {
162162
type: 'link',
163-
// @ts-expect-error: `null` is fine.
164163
title: null,
165164
url: 'mailto:' + atext + '@' + label,
166165
children: [{type: 'text', value: atext + '@' + label}]

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"index.js"
3939
],
4040
"dependencies": {
41+
"@types/mdast": "^3.0.0",
4142
"ccount": "^2.0.0",
4243
"mdast-util-find-and-replace": "^2.0.0",
4344
"micromark-util-character": "^1.0.0"

0 commit comments

Comments
 (0)