Closed as not planned
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
mdast-util-to-markdown
Steps to reproduce
With version 2.1.2:
import { toMarkdown } from 'mdast-util-to-markdown';
const tree = {
type: 'root',
children: [
{type: 'paragraph', children: [{type: 'text', value: 'a'}]},
{type: 'thematicBreak'},
{type: 'paragraph', children: [{type: 'text', value: 'b'}]}
]
};
const markdown = toMarkdown(tree);
console.log(markdown);
Run with tsc case.ts
Actual behavior
case.ts:12:29 - error TS2345: Argument of type '{ type: string; children: ({ type: string; children: { type: string; value: string; }[]; } | { type: string; children?: undefined; })[]; }' is not assignable to parameter of type 'Nodes'.
Type '{ type: string; children: ({ type: string; children: { type: string; value: string; }[]; } | { type: string; children?: undefined; })[]; }' is not assignable to type 'Root'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type '"root"'.
12 const markdown = toMarkdown(tree);
~~~~
Found 1 error in case.ts:12
Expected behavior
Output of:
a
***
b
Runtime
[email protected], Typescript 5.8.3
Package manager
Operating system
macOS 15.4.1
Build and bundle tools
No response