prism-react-renderer
prism-react-renderer copied to clipboard
TypeScript: PrismJS from npm is not assignable to Prism prop
The following code should compile, but it doesn't:
import Highlight from 'prism-react-renderer'
import Prism from 'prismjs'
export default function App() {
return <Highlight Prism={Prism}>{() => null}</Highlight>
}
https://codesandbox.io/s/prism-react-renderer-ts-issue-ongu6
Error for Googleability:
No overload matches this call.
Overload 1 of 2, '(props: HighlightProps | Readonly<HighlightProps>): Highlight', gave the following error.
Type 'typeof import("/sandbox/node_modules/@types/prismjs/index")' is not assignable to type 'PrismLib'.
Types of property 'languages' are incompatible.
Type 'Languages' is missing the following properties from type 'LanguageDict': markup, bash, clike, c, and 28 more.
Overload 2 of 2, '(props: HighlightProps, context: any): Highlight', gave the following error.
Type 'typeof import("/sandbox/node_modules/@types/prismjs/index")' is not assignable to type 'PrismLib'