Skip to content

Commit eca5b3c

Browse files
Point of comparison for export = hljs types
1 parent db48e96 commit eca5b3c

2 files changed

Lines changed: 4 additions & 41 deletions

File tree

src/ui/js/diff2html-ui-base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HighlightJS } from 'highlight.js/lib/highlight.js';
1+
import * as HighlightJS from 'highlight.js/lib/highlight.js';
22
import { ICompiledMode, IHighlightResult, IAutoHighlightResult } from 'highlight.js';
33
import { nodeStream, mergeStreams } from './highlight.js-helpers';
44

@@ -26,15 +26,15 @@ export class Diff2HtmlUI {
2626
readonly config: typeof defaultDiff2HtmlUIConfig;
2727
readonly diffHtml: string;
2828
readonly targetElement: HTMLElement;
29-
readonly hljs: HighlightJS | null = null;
29+
readonly hljs: typeof HighlightJS | null = null;
3030

3131
currentSelectionColumnId = -1;
3232

3333
constructor(
3434
target: HTMLElement,
3535
diffInput?: string | DiffFile[],
3636
config: Diff2HtmlUIConfig = {},
37-
hljs?: HighlightJS,
37+
hljs?: typeof HighlightJS,
3838
) {
3939
this.config = { ...defaultDiff2HtmlUIConfig, ...config };
4040
this.diffHtml = diffInput !== undefined ? html(diffInput, this.config) : target.innerHTML;

typings/highlight.js.d.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
11
declare module 'highlight.js/lib/highlight.js' {
22
import hljs from 'highlight.js';
33

4-
export type HighlightJS = typeof hljs;
5-
6-
export default hljs;
7-
8-
export const highlight: typeof hljs.highlight;
9-
export const highlightAuto: typeof hljs.highlightAuto;
10-
export const fixMarkup: typeof hljs.fixMarkup;
11-
export const highlightBlock: typeof hljs.highlightBlock;
12-
export const configure: typeof hljs.configure;
13-
export const initHighlighting: typeof hljs.initHighlighting;
14-
export const initHighlightingOnLoad: typeof hljs.initHighlightingOnLoad;
15-
export const registerLanguage: typeof hljs.registerLanguage;
16-
export const listLanguages: typeof hljs.listLanguages;
17-
export const getLanguage: typeof hljs.getLanguage;
18-
export const inherit: typeof hljs.inherit;
19-
export const COMMENT: typeof hljs.COMMENT;
20-
21-
export const IDENT_RE: typeof hljs.IDENT_RE;
22-
export const UNDERSCORE_IDENT_RE: typeof hljs.UNDERSCORE_IDENT_RE;
23-
export const NUMBER_RE: typeof hljs.NUMBER_RE;
24-
export const C_NUMBER_RE: typeof hljs.C_NUMBER_RE;
25-
export const BINARY_NUMBER_RE: typeof hljs.BINARY_NUMBER_RE;
26-
export const RE_STARTERS_RE: typeof hljs.RE_STARTERS_RE;
27-
28-
export const BACKSLASH_ESCAPE: typeof hljs.BACKSLASH_ESCAPE;
29-
export const APOS_STRING_MODE: typeof hljs.APOS_STRING_MODE;
30-
export const QUOTE_STRING_MODE: typeof hljs.QUOTE_STRING_MODE;
31-
export const PHRASAL_WORDS_MODE: typeof hljs.PHRASAL_WORDS_MODE;
32-
export const C_LINE_COMMENT_MODE: typeof hljs.C_LINE_COMMENT_MODE;
33-
export const C_BLOCK_COMMENT_MODE: typeof hljs.C_BLOCK_COMMENT_MODE;
34-
export const HASH_COMMENT_MODE: typeof hljs.HASH_COMMENT_MODE;
35-
export const NUMBER_MODE: typeof hljs.NUMBER_MODE;
36-
export const C_NUMBER_MODE: typeof hljs.C_NUMBER_MODE;
37-
export const BINARY_NUMBER_MODE: typeof hljs.BINARY_NUMBER_MODE;
38-
export const CSS_NUMBER_MODE: typeof hljs.CSS_NUMBER_MODE;
39-
export const REGEX_MODE: typeof hljs.REGEX_MODE;
40-
export const TITLE_MODE: typeof hljs.TITLE_MODE;
41-
export const UNDERSCORE_TITLE_MODE: typeof hljs.UNDERSCORE_TITLE_MODE;
4+
export = hljs;
425
}

0 commit comments

Comments
 (0)