Skip to content

Prism type not assignable to PrismLib prop type #203

@smartmike

Description

@smartmike

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions