mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
[rehype-react] Add Fragment option, update which options are optional (#41600)
* [rehype-react] Add Fragment option Usually this will be `React.Fragment`, but it accepts any component. * [rehype-react] Update which options are optional Most options have healthy defaults. Only `createElement` is required. * [rehype-react] Update version number * [rehype-react] Update tests to include Fragment option
This commit is contained in:
parent
4331db7e1c
commit
d01dbee933
5
types/rehype-react/index.d.ts
vendored
5
types/rehype-react/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for rehype-react 3.1
|
||||
// Type definitions for rehype-react 4.0
|
||||
// Project: https://github.com/rhysd/rehype-react
|
||||
// Definitions by: Adrian Kremer <https://github.com/adriankremer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -8,7 +8,8 @@ import * as React from "react";
|
||||
|
||||
interface Options {
|
||||
createElement: typeof React.createElement;
|
||||
components: {
|
||||
Fragment?: React.ComponentType<{ children?: React.ReactNode }>;
|
||||
components?: {
|
||||
[tagName: string]: React.ComponentType<any>;
|
||||
};
|
||||
prefix?: string;
|
||||
|
||||
@ -8,6 +8,7 @@ const htmlAst = {
|
||||
|
||||
const { Compiler: compile } = new RehypeReact({
|
||||
createElement: React.createElement,
|
||||
Fragment: React.Fragment,
|
||||
components: {
|
||||
button: () => {
|
||||
return <button />;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user