|
10 | 10 | * @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName
|
11 | 11 | * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
|
12 | 12 | *
|
13 |
| - * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction |
14 | 13 | * @typedef {import('mdast-util-find-and-replace').RegExpMatchObject} RegExpMatchObject
|
| 14 | + * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction |
15 | 15 | */
|
16 | 16 |
|
17 | 17 | import {ccount} from 'ccount'
|
18 |
| -import {findAndReplace} from 'mdast-util-find-and-replace' |
| 18 | +import {ok as assert} from 'devlop' |
19 | 19 | import {unicodePunctuation, unicodeWhitespace} from 'micromark-util-character'
|
| 20 | +import {findAndReplace} from 'mdast-util-find-and-replace' |
20 | 21 |
|
21 | 22 | /** @type {ConstructName} */
|
22 | 23 | const inConstruct = 'phrasing'
|
@@ -101,7 +102,8 @@ function exitLiteralAutolinkHttp(token) {
|
101 | 102 | */
|
102 | 103 | function exitLiteralAutolinkWww(token) {
|
103 | 104 | this.config.exit.data.call(this, token)
|
104 |
| - const node = /** @type {Link} */ (this.stack[this.stack.length - 1]) |
| 105 | + const node = this.stack[this.stack.length - 1] |
| 106 | + assert(node.type === 'link') |
105 | 107 | node.url = 'http://' + this.sliceSerialize(token)
|
106 | 108 | }
|
107 | 109 |
|
@@ -140,7 +142,7 @@ function transformGfmAutolinkLiterals(tree) {
|
140 | 142 | * @param {string} domain
|
141 | 143 | * @param {string} path
|
142 | 144 | * @param {RegExpMatchObject} match
|
143 |
| - * @returns {Link | Array<PhrasingContent> | false} |
| 145 | + * @returns {Array<PhrasingContent> | Link | false} |
144 | 146 | */
|
145 | 147 | // eslint-disable-next-line max-params
|
146 | 148 | function findUrl(_, protocol, domain, path, match) {
|
|
0 commit comments