prism-react-renderer icon indicating copy to clipboard operation
prism-react-renderer copied to clipboard

TypeScript: PrismJS from npm is not assignable to Prism prop

Open srmagura opened this issue 2 years ago • 0 comments

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'

srmagura avatar Jan 15 '22 19:01 srmagura