DefinitelyTyped has a definition for Highlight.js which defines and exports a module like so:
declare module "highlight.js"
{
module hljs
{
export function highlight(
name: string,
value: string,
ignore_illegals?: boolean,
continuation?: boolean) : IHighlightResult;
...
}
export = hljs;
}
In a given typescript file, I'm attempting to import the hljs
object so I can call the highlight
function on it, like so:
/// <reference path="../../tsd_typings/highlightjs/highlightjs.d.ts" />
import {hljs} from 'highlight.js';
...
hljs.highlightBlock(block);
But it fails saying that error TS2305: Module '"highlight.js"' has no exported member 'hljs'.
What is the proper way to import this object so I can compile my TS files without erros and warnings?