diff --git a/.changeset/popular-seals-occur.md b/.changeset/popular-seals-occur.md new file mode 100644 index 0000000..f367ffb --- /dev/null +++ b/.changeset/popular-seals-occur.md @@ -0,0 +1,5 @@ +--- +"prism-react-renderer": patch +--- + +Fix types for Prism library. diff --git a/packages/prism-react-renderer/src/types.ts b/packages/prism-react-renderer/src/types.ts index 012a063..2e23120 100644 --- a/packages/prism-react-renderer/src/types.ts +++ b/packages/prism-react-renderer/src/types.ts @@ -1,25 +1,10 @@ import type { CSSProperties } from "react" -import type { Token as PrismToken } from "prismjs" +import type { Token as PrismToken, Grammar } from "prismjs" +import Prism from "prismjs" export type Language = string -export type PrismGrammar = Record -type LanguagesDict = Record - -export type PrismLib = { - languages: LanguagesDict - tokenize: (code: string, grammar: PrismGrammar) => Array - highlight: (code: string, grammar: PrismGrammar, language: Language) => string - hooks: { - run: ( - name: string, - env: { - code: string - grammar: PrismGrammar - language: Language - } - ) => void - } -} +export type PrismGrammar = Grammar +export type PrismLib = typeof Prism export type Token = { types: string[]