react-markdown
Advanced tools
Comparing version
@@ -68,3 +68,3 @@ /** | ||
*/ | ||
export type Components = { [Key in Extract<ElementType, string>]?: ElementType<ComponentProps<Key> & ExtraProps>; }; | ||
export type Components = { [Key in keyof JSX.IntrinsicElements]?: ComponentType<JSX.IntrinsicElements[Key] & ExtraProps> | keyof JSX.IntrinsicElements; }; | ||
/** | ||
@@ -148,6 +148,6 @@ * Deprecation. | ||
import type { Parents } from 'hast'; | ||
import type { ElementType } from 'react'; | ||
import type { ComponentProps } from 'react'; | ||
import type { JSX } from 'react'; | ||
import type { ComponentType } from 'react'; | ||
import type { PluggableList } from 'unified'; | ||
import type { Options as RemarkRehypeOptions } from 'remark-rehype'; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* @import {Element, Nodes, Parents, Root} from 'hast' | ||
* @import {Root as MdastRoot} from 'mdast' | ||
* @import {ComponentProps, ElementType, ReactElement} from 'react' | ||
* @import {ComponentType, JSX, ReactElement} from 'react' | ||
* @import {Options as RemarkRehypeOptions} from 'remark-rehype' | ||
@@ -32,3 +32,3 @@ * @import {BuildVisitor} from 'unist-util-visit' | ||
* @typedef {{ | ||
* [Key in Extract<ElementType, string>]?: ElementType<ComponentProps<Key> & ExtraProps> | ||
* [Key in keyof JSX.IntrinsicElements]?: ComponentType<JSX.IntrinsicElements[Key] & ExtraProps> | keyof JSX.IntrinsicElements | ||
* }} Components | ||
@@ -329,5 +329,2 @@ * Map tag names to components. | ||
Fragment, | ||
// @ts-expect-error | ||
// React components are allowed to return numbers, | ||
// but not according to the types in hast-util-to-jsx-runtime | ||
components, | ||
@@ -334,0 +331,0 @@ ignoreInvalidStyle: true, |
@@ -144,3 +144,3 @@ { | ||
"type": "module", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"xo": { | ||
@@ -147,0 +147,0 @@ "envs": [ |
@@ -194,3 +194,3 @@ <!-- | ||
React element (`JSX.Element`). | ||
React element (`ReactElement`). | ||
@@ -213,3 +213,3 @@ ### `MarkdownAsync` | ||
Promise to a React element (`Promise<JSX.Element>`). | ||
Promise to a React element (`Promise<ReactElement>`). | ||
@@ -232,3 +232,3 @@ ### `MarkdownHooks` | ||
React element (`JSX.Element`). | ||
React element (`ReactElement`). | ||
@@ -272,13 +272,8 @@ ### `defaultUrlTransform(url)` | ||
```ts | ||
import type {Element} from 'hast' | ||
import type {ExtraProps} from 'react-markdown' | ||
import type {ComponentProps, ElementType} from 'react' | ||
type Components = Partial<{ | ||
[TagName in keyof JSX.IntrinsicElements]: | ||
// Class component: | ||
| (new (props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.ElementClass) | ||
// Function component: | ||
| ((props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.Element | string | null | undefined) | ||
// Tag name: | ||
| keyof JSX.IntrinsicElements | ||
}> | ||
type Components = { | ||
[Key in Extract<ElementType, string>]?: ElementType<ComponentProps<Key> & ExtraProps> | ||
} | ||
``` | ||
@@ -285,0 +280,0 @@ |
Sorry, the diff of this file is not supported yet
51028
-0.52%553
-0.54%926
-0.54%