diff --git a/.changeset/gentle-bikes-float.md b/.changeset/gentle-bikes-float.md new file mode 100644 index 00000000..da8295d0 --- /dev/null +++ b/.changeset/gentle-bikes-float.md @@ -0,0 +1,5 @@ +--- +'markdown-to-jsx': patch +--- + +Use `ReactNode` instead of `ReactChild` for React 19 compatibility diff --git a/.yarn/cache/@esbuild-darwin-x64-npm-0.19.11-cbbb06eafc-10.zip b/.yarn/cache/@esbuild-darwin-x64-npm-0.19.11-cbbb06eafc-10.zip new file mode 100644 index 00000000..779527e7 Binary files /dev/null and b/.yarn/cache/@esbuild-darwin-x64-npm-0.19.11-cbbb06eafc-10.zip differ diff --git a/.yarn/cache/@esbuild-win32-x64-npm-0.19.11-45828b663c-10.zip b/.yarn/cache/@esbuild-win32-x64-npm-0.19.11-45828b663c-10.zip new file mode 100644 index 00000000..afc30edb Binary files /dev/null and b/.yarn/cache/@esbuild-win32-x64-npm-0.19.11-45828b663c-10.zip differ diff --git a/.yarn/cache/fsevents-patch-19706e7e35-10.zip b/.yarn/cache/fsevents-patch-19706e7e35-10.zip new file mode 100644 index 00000000..aff1ab12 Binary files /dev/null and b/.yarn/cache/fsevents-patch-19706e7e35-10.zip differ diff --git a/.yarnrc.yml b/.yarnrc.yml index 9b24c1e9..070415b0 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -5,3 +5,9 @@ enableGlobalCache: false nodeLinker: node-modules yarnPath: .yarn/releases/yarn-4.5.1.cjs + +supportedArchitectures: + os: + - linux + - win32 + - darwin diff --git a/index.tsx b/index.tsx index a2ea4e90..78be45ae 100644 --- a/index.tsx +++ b/index.tsx @@ -1053,7 +1053,7 @@ function reactFor(render) { return function patchedRender( ast: MarkdownToJSX.ParserResult | MarkdownToJSX.ParserResult[], state: MarkdownToJSX.State = {} - ): React.ReactChild[] { + ): React.ReactNode[] { if (Array.isArray(ast)) { const oldKey = state.key const result = [] @@ -1094,7 +1094,7 @@ function createRenderer( ast: MarkdownToJSX.ParserResult, render: MarkdownToJSX.RuleOutput, state: MarkdownToJSX.State - ): React.ReactChild { + ): React.ReactNode { const renderer = rules[ast.type].render as MarkdownToJSX.Rule['render'] return userRender @@ -2292,7 +2292,7 @@ export namespace MarkdownToJSX { */ render: RuleOutput, state?: MarkdownToJSX.State - ) => React.ReactChild + ) => React.ReactNode } export type Rules = { @@ -2321,8 +2321,8 @@ export namespace MarkdownToJSX { createElement: ( tag: Parameters[0], props: React.JSX.IntrinsicAttributes, - ...children: React.ReactChild[] - ) => React.ReactChild + ...children: React.ReactNode[] + ) => React.ReactNode /** * The library automatically generates an anchor tag for bare URLs included in the markdown @@ -2414,14 +2414,14 @@ export namespace MarkdownToJSX { */ renderRule: ( /** Resume normal processing, call this function as a fallback if you are not returning custom JSX. */ - next: () => React.ReactChild, + next: () => React.ReactNode, /** the current AST node, use `RuleType` against `node.type` for identification */ node: ParserResult, /** use as `renderChildren(node.children)` for block nodes */ renderChildren: RuleOutput, /** contains `key` which should be supplied to the topmost JSX element */ state: State - ) => React.ReactChild + ) => React.ReactNode /** * Override the built-in sanitizer function for URLs, etc if desired. The built-in version is available as a library export called `sanitizer`.