Skip to content

Commit 44dc4b8

Browse files
committed
Fix types for TS 4.9
1 parent 2c8bd7f commit 44dc4b8

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

index.js

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* @typedef {import('mdast').Link} Link
3+
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
34
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
45
* @typedef {import('mdast-util-from-markdown').Transform} FromMarkdownTransform
56
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
@@ -41,47 +42,74 @@ export const gfmAutolinkLiteralToMarkdown = {
4142
before: '[+\\-.\\w]',
4243
after: '[\\-.\\w]',
4344
inConstruct,
45+
// @ts-expect-error: to do: use map.
4446
notInConstruct
4547
},
4648
{
4749
character: '.',
4850
before: '[Ww]',
4951
after: '[\\-.\\w]',
5052
inConstruct,
53+
// @ts-expect-error: to do: use map.
5154
notInConstruct
5255
},
53-
{character: ':', before: '[ps]', after: '\\/', inConstruct, notInConstruct}
56+
{
57+
character: ':',
58+
before: '[ps]',
59+
after: '\\/',
60+
inConstruct,
61+
// @ts-expect-error: to do: use map.
62+
notInConstruct
63+
}
5464
]
5565
}
5666

57-
/** @type {FromMarkdownHandle} */
67+
/**
68+
* @this {CompileContext}
69+
* @type {FromMarkdownHandle}
70+
*/
5871
function enterLiteralAutolink(token) {
5972
this.enter({type: 'link', title: null, url: '', children: []}, token)
6073
}
6174

62-
/** @type {FromMarkdownHandle} */
75+
/**
76+
* @this {CompileContext}
77+
* @type {FromMarkdownHandle}
78+
*/
6379
function enterLiteralAutolinkValue(token) {
6480
this.config.enter.autolinkProtocol.call(this, token)
6581
}
6682

67-
/** @type {FromMarkdownHandle} */
83+
/**
84+
* @this {CompileContext}
85+
* @type {FromMarkdownHandle}
86+
*/
6887
function exitLiteralAutolinkHttp(token) {
6988
this.config.exit.autolinkProtocol.call(this, token)
7089
}
7190

72-
/** @type {FromMarkdownHandle} */
91+
/**
92+
* @this {CompileContext}
93+
* @type {FromMarkdownHandle}
94+
*/
7395
function exitLiteralAutolinkWww(token) {
7496
this.config.exit.data.call(this, token)
7597
const node = /** @type {Link} */ (this.stack[this.stack.length - 1])
7698
node.url = 'http://' + this.sliceSerialize(token)
7799
}
78100

79-
/** @type {FromMarkdownHandle} */
101+
/**
102+
* @this {CompileContext}
103+
* @type {FromMarkdownHandle}
104+
*/
80105
function exitLiteralAutolinkEmail(token) {
81106
this.config.exit.autolinkEmail.call(this, token)
82107
}
83108

84-
/** @type {FromMarkdownHandle} */
109+
/**
110+
* @this {CompileContext}
111+
* @type {FromMarkdownHandle}
112+
*/
85113
function exitLiteralAutolink(token) {
86114
this.exit(token)
87115
}

0 commit comments

Comments
 (0)