From 7d4b2f15a3b9660e2840e2ce055153301cbeb2c8 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Mon, 5 Oct 2020 17:25:32 +0530 Subject: [PATCH] update(types): Expose more types from prism --- src/types/prism-types.ts | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/types/prism-types.ts b/src/types/prism-types.ts index 1c93067..78becbd 100644 --- a/src/types/prism-types.ts +++ b/src/types/prism-types.ts @@ -3,3 +3,49 @@ export type Token = { content: string; empty?: boolean; }; + +export type RenderProps = { + tokens: Token[][]; + className: string; + style: StyleObj; + getLineProps: (input: LineInputProps) => LineOutputProps; + getTokenProps: (input: TokenInputProps) => TokenOutputProps; +}; + +export type StyleObj = { + [key: string]: string | number | null; +}; + +export type LineInputProps = { + key?: React.Key; + style?: StyleObj; + className?: string; + line: Token[]; + [otherProp: string]: any; +}; + +export type LineOutputProps = { + key?: React.Key; + style?: StyleObj; + className: string; + [otherProps: string]: any; +}; + +export type TokenInputProps = { + key?: React.Key; + style?: StyleObj; + className?: string; + token: Token; + [otherProp: string]: any; +}; + +export type TokenOutputProps = { + key?: React.Key; + style?: StyleObj; + className: string; + children: string; + [otherProp: string]: any; +}; + +export type TgetLineProps = (input: LineInputProps) => LineOutputProps; +export type TgetTokenProps = (input: TokenInputProps) => TokenOutputProps;