Skip to content

Commit 23dfd08

Browse files
committed
fix: more type fixes
1 parent 0d244c6 commit 23dfd08

File tree

10 files changed

+454
-25
lines changed

10 files changed

+454
-25
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ index.js
99
docs/_build
1010
docs/examples/*.md
1111
docs/nodes
12-
docs/myst.schema.md
12+
docs/myst.schema.md
13+
*.tsbuildinfo

src/admonitions.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@ export interface AdmonitionTitle extends Parent {
55
type: 'admonitionTitle';
66
children: PhrasingContent[];
77
}
8-
9-
export type AdmonitionKind =
10-
| 'attention'
11-
| 'caution'
12-
| 'danger'
13-
| 'error'
14-
| 'hint'
15-
| 'important'
16-
| 'note'
17-
| 'seealso'
18-
| 'tip'
19-
| 'warning';
20-
218
export interface Admonition extends Parent {
229
type: 'admonition';
23-
kind?: AdmonitionKind;
10+
kind?:
11+
| 'attention'
12+
| 'caution'
13+
| 'danger'
14+
| 'error'
15+
| 'hint'
16+
| 'important'
17+
| 'note'
18+
| 'seealso'
19+
| 'tip'
20+
| 'warning';
2421
class?: string;
2522
children: (FlowContent | AdmonitionTitle)[];
2623
}

src/index.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,25 @@ declare module 'mdast' {
1515
}
1616

1717
// All nodes are referenceable now
18-
interface Node extends Partial<Association> {}
18+
interface Blockquote extends Partial<Association> {}
19+
interface Break extends Partial<Association> {}
20+
interface Code extends Partial<Association> {}
21+
interface Delete extends Partial<Association> {}
22+
interface Emphasis extends Partial<Association> {}
23+
interface Heading extends Partial<Association> {}
24+
interface Html extends Partial<Association> {}
25+
interface Image extends Partial<Association> {}
26+
interface InlineCode extends Partial<Association> {}
27+
interface List extends Partial<Association> {}
28+
interface ListItem extends Partial<Association> {}
29+
interface Paragraph extends Partial<Association> {}
30+
interface Root extends Partial<Association> {}
31+
interface Strong extends Partial<Association> {}
32+
interface Table extends Partial<Association> {}
33+
interface TableRow extends Partial<Association> {}
34+
interface TableCell extends Partial<Association> {}
35+
interface Text extends Partial<Association> {}
36+
interface ThematicBreak extends Partial<Association> {}
1937

2038
interface PhrasingContentMap {
2139
inlineMath: InlineMath;

src/tables.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import type { Parent, PhrasingContent } from 'mdast';
22

3-
export type AlignType = 'left' | 'center' | 'right';
4-
53
export interface TableCell extends Parent {
64
type: 'tableCell';
7-
align?: AlignType;
5+
align?: 'left' | 'center' | 'right';
86
children: PhrasingContent[];
97
}
108

@@ -15,6 +13,6 @@ export interface TableRow extends Parent {
1513

1614
export interface Table extends Parent {
1715
type: 'table';
18-
align?: AlignType;
16+
align?: 'left' | 'center' | 'right';
1917
children: TableRow[];
2018
}

test/build/test.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
1+
import type { Literal } from 'mdast';
2+
interface Toml extends Literal {
3+
type: 'toml';
4+
}
5+
declare module 'mdast' {
6+
interface RootContentMap {
7+
toml: Toml;
8+
}
9+
interface FrontmatterContentMap {
10+
toml: Toml;
11+
}
12+
}
13+
declare module 'mdast' {
14+
interface Data {
15+
someField?: string | undefined;
16+
}
17+
interface InlineCodeData {
18+
someOtherField?: number | undefined;
19+
}
20+
}
121
export {};
222
//# sourceMappingURL=test.d.ts.map

test/build/test.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/build/test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,11 @@ var inlineCodeWithData = {
310310
someUnknownField: true,
311311
},
312312
};
313+
// @ts-expect-error: `url` is required.
314+
var linkWithoutUrl = {};
313315
var paragraphWithRole = {
314316
type: 'paragraph',
315-
children: [{ type: 'mystRoles', name: 'ref', value: '' }],
317+
children: [{ type: 'mystRole', name: 'ref', value: '', children: [] }],
316318
};
317319
// Assert that there are no incorrect keys.
318320
// If there are, these is not assignable.

test/build/tsconfig.tsbuildinfo

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)