1
1
/**
2
+ * @typedef {import('mdast').Link } Link
2
3
* @typedef {import('mdast-util-from-markdown').Extension } FromMarkdownExtension
3
4
* @typedef {import('mdast-util-from-markdown').Transform } FromMarkdownTransform
4
5
* @typedef {import('mdast-util-from-markdown').Handle } FromMarkdownHandle
@@ -55,7 +56,6 @@ export const gfmAutolinkLiteralToMarkdown = {
55
56
56
57
/** @type {FromMarkdownHandle } */
57
58
function enterLiteralAutolink ( token ) {
58
- // @ts -expect-error: `null` is fine.
59
59
this . enter ( { type : 'link' , title : null , url : '' , children : [ ] } , token )
60
60
}
61
61
@@ -72,7 +72,8 @@ function exitLiteralAutolinkHttp(token) {
72
72
/** @type {FromMarkdownHandle } */
73
73
function exitLiteralAutolinkWww ( token ) {
74
74
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 )
76
77
}
77
78
78
79
/** @type {FromMarkdownHandle } */
@@ -130,7 +131,6 @@ function findUrl(_, protocol, domain, path, match) {
130
131
if ( ! parts [ 0 ] ) return false
131
132
132
133
/** @type {PhrasingContent } */
133
- // @ts -expect-error: `null` is fine.
134
134
const result = {
135
135
type : 'link' ,
136
136
title : null ,
@@ -160,7 +160,6 @@ function findEmail(_, atext, label, match) {
160
160
161
161
return {
162
162
type : 'link' ,
163
- // @ts -expect-error: `null` is fine.
164
163
title : null ,
165
164
url : 'mailto:' + atext + '@' + label ,
166
165
children : [ { type : 'text' , value : atext + '@' + label } ]
0 commit comments