Skip to content

Commit

Permalink
Add global type declarations for Prism
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Oct 15, 2024
1 parent 648ddef commit 7a106a6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/lexical-code/src/CodeHighlighterPrism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-java';
import 'prismjs/components/prism-cpp';

export const Prism: typeof import('prismjs') = globalThis.Prism || window.Prism;
declare global {
interface Window {
Prism: typeof import('prismjs');
}
}

export const Prism: typeof import('prismjs') =
(globalThis as {Prism?: typeof import('prismjs')}).Prism || window.Prism;

0 comments on commit 7a106a6

Please sign in to comment.