File tree Expand file tree Collapse file tree 2 files changed +9
-19
lines changed
packages/prism-react-renderer/src Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " prism-react-renderer " : patch
3
+ ---
4
+
5
+ Fix types for Prism library.
Original file line number Diff line number Diff line change 1
1
import type { CSSProperties } from "react"
2
- import type { Token as PrismToken } from "prismjs"
2
+ import type { Token as PrismToken , Grammar } from "prismjs"
3
+ import Prism from "prismjs"
3
4
4
5
export type Language = string
5
- export type PrismGrammar = Record < string , unknown >
6
- type LanguagesDict = Record < Language , PrismGrammar >
7
-
8
- export type PrismLib = {
9
- languages : LanguagesDict
10
- tokenize : ( code : string , grammar : PrismGrammar ) => Array < PrismToken | string >
11
- highlight : ( code : string , grammar : PrismGrammar , language : Language ) => string
12
- hooks : {
13
- run : (
14
- name : string ,
15
- env : {
16
- code : string
17
- grammar : PrismGrammar
18
- language : Language
19
- }
20
- ) => void
21
- }
22
- }
6
+ export type PrismGrammar = Grammar
7
+ export type PrismLib = typeof Prism
23
8
24
9
export type Token = {
25
10
types : string [ ]
You can’t perform that action at this time.
0 commit comments