Skip to content

Types of property 'pre' are incompatible when using inside MDXComponents for generating RSS feed #1940

Discussion options

You must be logged in to vote

The issue is

interface IPre {
	children: React.ReactChild
	theme: string
	showLineNumbers: boolean
}

children of intrinsic elements is React.ReactElement not React.ReactChild
theme and showLineNumbers should also be marked as optional because they may not be passed.

interface IPre {
  children: React.ReactElement;
  theme?: string;
  showLineNumbers?: boolean;
}

Example in sandbox showing that it can be typed without any https://codesandbox.io/s/component-typing-example-dvc35?file=/src/App.tsx:73-170

Replies: 8 comments 19 replies

Comment options

You must be logged in to vote
8 replies
@wooorm
Comment options

@deadcoder0904
Comment options

@deadcoder0904
Comment options

@wooorm
Comment options

@deadcoder0904
Comment options

Comment options

You must be logged in to vote
2 replies
@ChristianMurphy
Comment options

@deadcoder0904
Comment options

Comment options

You must be logged in to vote
3 replies
@deadcoder0904
Comment options

@ChristianMurphy
Comment options

@deadcoder0904
Comment options

Answer selected by ChristianMurphy
Comment options

You must be logged in to vote
4 replies
@wooorm
Comment options

@remcohaszing
Comment options

@remcohaszing
Comment options

@wooorm
Comment options

Comment options

You must be logged in to vote
1 reply
@remcohaszing
Comment options

Comment options

You must be logged in to vote
1 reply
@zenera
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
☂️ area/types This affects typings
5 participants