Created
August 26, 2020 00:53
-
-
Save ktmud/3d796360534b3a103fd7406f6b6160e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ReactNode, | |
HTMLAttributes, | |
CSSProperties, | |
HTMLProps, | |
MutableRefObject, | |
FunctionComponent, | |
} from 'react'; | |
declare module 'react-syntax-highlighter' { | |
export interface SyntaxHighlighterReactNode { | |
properties: HTMLAttributes<HTMLElement>; | |
type?: 'text'; | |
tagName?: keyof HTMLElementTagNameMap; | |
} | |
export interface LightHighlighter extends FunctionComponent<SyntaxHighlighterProps> { | |
registerLanguage: (languageName: string, definition: object) => void; | |
} | |
export interface SyntaxHighlighterCodeRenderer { | |
(options: { | |
rows: SyntaxHighlighterReactNode[]; | |
stylesheet: CSSProperties; | |
useInlineStyles: boolean; | |
}): ReactNode; | |
} | |
export interface SyntaxHighlighterProps { | |
renderer?: SyntaxHighlighterCodeRenderer; | |
// @ts-ignore | |
codeTagProps?: HTMLProps<HTMLElement> & { ref: MutableRefObject<HTMLElement> }; | |
} | |
export function createElement(options: { | |
node: SyntaxHighlighterReactNode; | |
stylesheet: CSSProperties; | |
style?: Record<string, CSSProperties>; | |
useInlineStyles: boolean; | |
key: string; | |
}): ReactNode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment