Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.d.ts #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

CodingByJerez
Copy link

To fix the typescript error

@wooziet
Copy link

wooziet commented Sep 14, 2022

Bump

@MoonRainy21
Copy link

MoonRainy21 commented Oct 15, 2022

found the same error and fixed it in the same way

@Avishayy
Copy link

Can we merge this please? Thanks!

@markrickert
Copy link

Another possible better fix is to just change the MarkdownStatic type to:

type MarkdownStatic = React.ComponentType<React.PropsWithChildren<MarkdownProps>>;

You can use patch-package to update this type with the following patch:

./patches/react-native-markdown-display+6.1.6.patch

diff --git a/node_modules/react-native-markdown-display/src/index.d.ts b/node_modules/react-native-markdown-display/src/index.d.ts
index eb9ff5b..4add358 100644
--- a/node_modules/react-native-markdown-display/src/index.d.ts
+++ b/node_modules/react-native-markdown-display/src/index.d.ts
@@ -93,7 +93,9 @@ export interface MarkdownProps {
   onLinkPress?: (url: string) => boolean;
 }
 
-type MarkdownStatic = React.ComponentType<MarkdownProps>;
+// Patch applied for allowing children of the MarkdownStatic component.
+// Remove patch when this PR is merged: https://github.com/iamacup/react-native-markdown-display/pull/178
+type MarkdownStatic = React.ComponentType<React.PropsWithChildren<MarkdownProps>>;
 export const Markdown: MarkdownStatic;
 export type Markdown = MarkdownStatic;
 export {MarkdownIt};

@@ -89,6 +89,7 @@ export interface MarkdownProps {
mergeStyle?: boolean;
debugPrintTree?: boolean;
onLinkPress?: (url: string) => boolean;
children: string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to wrap this interface with PropsWithChildren from react.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants