Skip to content

Commit 6819e55

Browse files
committed
Update package lock
`hast-util-to-jsx-runtime`, an internally used dependency, fixed asignability of the React JSX runtime to it. This commit also changes the docs to remove workarounds for the old behavior. Closes GH-2465.
1 parent e8c625f commit 6819e55

File tree

7 files changed

+615
-812
lines changed

7 files changed

+615
-812
lines changed

docs/_asset/editor.jsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ function Playground() {
204204
/** @type {MDXModule} */
205205
const result = await run(String(file), {
206206
Fragment,
207-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
208207
jsx,
209-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
210208
jsxs,
211209
baseUrl: window.location.href
212210
})
@@ -230,7 +228,6 @@ function Playground() {
230228
JSON.stringify(ast, undefined, 2),
231229
'source.json'
232230
),
233-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
234231
{Fragment, jsx, jsxs}
235232
)}
236233
</code>
@@ -244,9 +241,7 @@ function Playground() {
244241
<code>
245242
{toJsxRuntime(starryNight.highlight(String(file), 'source.js'), {
246243
Fragment,
247-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
248244
jsx,
249-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
250245
jsxs
251246
})}
252247
</code>
@@ -339,9 +334,7 @@ function Playground() {
339334
<div className="playground-draw">
340335
{toJsxRuntime(starryNight.highlight(value, scope), {
341336
Fragment,
342-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
343337
jsx,
344-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
345338
jsxs
346339
})}
347340
{/* Trailing whitespace in a `textarea` is shown, but not in a `div`

docs/_component/blog.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export function BlogEntry(properties) {
6767
</h3>
6868
<div>
6969
{meta.descriptionHast ? (
70-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
7170
toJsxRuntime(meta.descriptionHast, {Fragment, jsx, jsxs})
7271
) : description ? (
7372
<p>{description}</p>

docs/_component/nav.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export function NavigationItem(properties) {
104104
properties: {className: ['nav-description']},
105105
children
106106
},
107-
// @ts-expect-error: to do: fix in `hast-util-to-jsx-runtime`.
108107
{Fragment, jsx, jsxs}
109108
)
110109
} else {

docs/guides/mdx-on-demand.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import * as runtime from 'react/jsx-runtime'
4444

4545
const code = '' // To do: get `code` from server somehow.
4646

47-
// @ts-expect-error: `runtime` types are currently broken.
4847
const {default: Content} = await run(code, {...runtime, baseUrl: import.meta.url})
4948
```
5049
@@ -89,7 +88,6 @@ export default function Page({code}) {
8988
useEffect(
9089
function () {
9190
;(async function () {
92-
// @ts-expect-error: `runtime` types are currently broken.
9391
setMdxModule(await run(code, {...runtime, baseUrl: import.meta.url}))
9492
})()
9593
},

docs/migrating/v3.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ If you use `react/jsx-runtime`, you might get a TypeScript error (such as
5757
To remediate this, do:
5858

5959
```tsx
60-
import {type Fragment, type Jsx, run} from '@mdx-js/mdx'
61-
import * as runtime_ from 'react/jsx-runtime'
62-
63-
// @ts-expect-error: the automatic react runtime is untyped.
64-
const runtime: {Fragment: Fragment; jsx: Jsx; jsxs: Jsx} = runtime_
60+
import * as runtime from 'react/jsx-runtime'
6561

6662
const result = await run('# hi', {...runtime, baseUrl: import.meta.url})
6763
```

0 commit comments

Comments
 (0)