Skip to content

Commit 13430aa

Browse files
committed
Update types for changes in micromark-util-types
1 parent cd10e59 commit 13430aa

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

dev/index.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,16 @@ export interface CompileData {
7575
referenceType?: 'collapsed' | 'full' | undefined
7676
}
7777

78+
declare module 'micromark-util-types' {
79+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
80+
interface TokenTypeMap {
81+
listItem: 'listItem'
82+
}
83+
84+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
85+
interface Token {
86+
_spread?: boolean
87+
}
88+
}
89+
7890
export {fromMarkdown} from './lib/index.js'

dev/lib/index.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ export const fromMarkdown =
192192

193193
return compiler(options)(
194194
postprocess(
195-
// @ts-expect-error: micromark types need to accept `null`.
196195
parse(options).document().write(preprocess()(value, encoding, true))
197196
)
198197
)
@@ -504,7 +503,6 @@ function compiler(options) {
504503
firstBlankLineIndex &&
505504
(!lineIndex || firstBlankLineIndex < lineIndex)
506505
) {
507-
// @ts-expect-error Patched.
508506
listItem._spread = true
509507
}
510508

@@ -523,9 +521,10 @@ function compiler(options) {
523521
if (event[1].type === types.listItemPrefix) {
524522
listItem = {
525523
type: 'listItem',
526-
// @ts-expect-error Patched
527524
_spread: false,
528-
start: Object.assign({}, event[1].start)
525+
start: Object.assign({}, event[1].start),
526+
// @ts-expect-error: we’ll add `end` in a second.
527+
end: undefined
529528
}
530529
// @ts-expect-error: `listItem` is most definitely defined, TS...
531530
events.splice(index, 0, ['enter', listItem, event[2]])
@@ -537,7 +536,6 @@ function compiler(options) {
537536
}
538537
}
539538

540-
// @ts-expect-error Patched.
541539
events[start][1]._spread = listSpread
542540
return length
543541
}
@@ -1339,7 +1337,6 @@ function compiler(options) {
13391337
type: 'list',
13401338
ordered: token.type === 'listOrdered',
13411339
start: null,
1342-
// @ts-expect-error Patched.
13431340
spread: token._spread,
13441341
children: []
13451342
}
@@ -1352,7 +1349,6 @@ function compiler(options) {
13521349
function listItem(token) {
13531350
return {
13541351
type: 'listItem',
1355-
// @ts-expect-error Patched.
13561352
spread: token._spread,
13571353
checked: null,
13581354
children: []

0 commit comments

Comments
 (0)