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 } */
5758function 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 } */
7373function 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 } ]
0 commit comments