Skip to content

Commit e093df5

Browse files
committed
Fix to allow assigning react runtime to types
Related-to: mdx-js/mdx#2465.
1 parent b0e5702 commit e093df5

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/types.d.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ type FunctionComponent<ComponentProps> = (
141141
* Create a production element.
142142
*/
143143
export type Jsx = (
144-
type: unknown,
144+
// `any` because runtimes often have complex framework-specific types here.
145+
// type-coverage:ignore-next-line
146+
type: any,
145147
props: Props,
146148
key?: string | undefined
147149
) => JSX.Element
@@ -150,7 +152,9 @@ export type Jsx = (
150152
* Create a development element.
151153
*/
152154
export type JsxDev = (
153-
type: unknown,
155+
// `any` because runtimes often have complex framework-specific types here.
156+
// type-coverage:ignore-next-line
157+
type: any,
154158
props: Props,
155159
key: string | undefined,
156160
isStaticChildren: boolean,

test/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ test('properties', async function (t) {
257257
}),
258258
{
259259
...production,
260+
/**
261+
* @param {unknown} type
262+
*/
260263
jsx(type, props) {
261264
foundProps = props
262265
return production.jsx(type, {})
@@ -671,6 +674,9 @@ test('react specific: `align` to `style`', async function (t) {
671674
renderToStaticMarkup(
672675
toJsxRuntime(h('td', {align: 'center'}), {
673676
...production,
677+
/**
678+
* @param {unknown} type
679+
*/
674680
jsx(type, props) {
675681
foundProps = props
676682
return production.jsx(type, {})
@@ -695,6 +701,9 @@ test('react specific: `align` to `style`', async function (t) {
695701
renderToStaticMarkup(
696702
toJsxRuntime(h('td', {align: 'center'}), {
697703
...production,
704+
/**
705+
* @param {unknown} type
706+
*/
698707
jsx(type, props) {
699708
foundProps = props
700709
return production.jsx(type, {})

0 commit comments

Comments
 (0)