FormidableLabs / prism-react-renderer

🖌️ Renders highlighted Prism output to React (+ theming & vendored Prism)
MIT License
1.87k stars 152 forks source link

Prism type not assignable to PrismLib prop type #203

Closed smartmike closed 1 year ago

smartmike commented 1 year ago

Hey! 👋

I have an typescript error passing Prism as a prop to Highlight. This happens on both Prism imported from prismjs and the exported Prism from prism-react-renderer

Error:

Type 'typeof import("./node_modules/@types/prismjs/index")' is not assignable to type 'PrismLib'.
  Types of property 'languages' are incompatible.
    Type 'Languages' is not assignable to type 'LanguagesDict'.
      'string' index signatures are incompatible.
        Type 'Grammar' is not assignable to type 'PrismGrammar'.
          Type 'GrammarRest' is not assignable to type 'PrismGrammar'.
            Index signature for type 'string' is missing in type 'GrammarRest'.ts(2322)

Reproducible sandbox: https://codesandbox.io/s/sweet-fire-jmfge6?file=/src/App.tsx

image

Please let me know if you need more info, or if I have missed something :)

carloskelly13 commented 1 year ago

Good catch, we'll get this fixed up.