Skip to content

Commit 45e0e4c

Browse files
Use mdast typings
1 parent d8a75ee commit 45e0e4c

File tree

2 files changed

+3
-43
lines changed

2 files changed

+3
-43
lines changed

types/index.d.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,10 @@
11
// TypeScript Version: 3.0
22

3-
import {Node, Parent} from 'unist'
3+
import {Node} from 'unist'
4+
import {Parent, Heading, Link, Paragraph, List, ListItem} from 'mdast'
45
import {Test} from 'unist-util-is'
56

67
declare namespace mdastUtilToc {
7-
interface Link extends Parent {
8-
type: 'link'
9-
title: null
10-
url: string
11-
children: Node[]
12-
}
13-
14-
interface Paragraph extends Parent {
15-
type: 'paragraph'
16-
children: Link[]
17-
}
18-
19-
interface ListItem extends Parent {
20-
type: 'listItem'
21-
loose: boolean
22-
spread: boolean
23-
children: Node[]
24-
}
25-
26-
interface List extends Parent {
27-
type: 'list'
28-
ordered: boolean
29-
spread: boolean
30-
children: ListItem[]
31-
}
328

339
interface TOCOptions {
3410
heading?: string

types/mdast-util-toc-tests.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
1-
import {Parent} from 'unist'
1+
import {Link, Paragraph, List, ListItem} from 'mdast'
22

33
import unified = require('unified')
44
import u = require('unist-builder')
55
import is = require('unist-util-is')
66
import toc = require('mdast-util-toc')
77

8-
interface Link extends Parent {
9-
type: 'link'
10-
}
11-
12-
interface Paragraph extends Parent {
13-
type: 'paragraph'
14-
}
15-
16-
interface List extends Parent {
17-
type: 'list'
18-
}
19-
20-
interface ListItem extends Parent {
21-
type: 'listItem'
22-
}
23-
248
const tree = u('root', [
259
u('heading', {depth: 1}, [u('text', 'Alpha')]),
2610
u('heading', {depth: 2}, [u('text', 'Bravo')]),

0 commit comments

Comments
 (0)