diff --git a/package.json b/package.json index cee9f88..3df4643 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.1.9", "description": "🌈 Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection", "main": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { ".": "./dist/index.js", "./index.js": "./dist/index.js", @@ -55,5 +56,10 @@ "@rollup/plugin-terser": "^0.4.3", "rollup": "^2.75.7", "rollup-plugin-copy": "^3.4.0" + }, + "typesVersions": { + "*": { + "*": ["dist/*", "dist"] + } } } diff --git a/src/index.d.ts b/src/index.d.ts index ac7b594..de41041 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -41,7 +41,10 @@ export type ShjLanguageComponent = match: RegExp; sub: | string - | ((code: string) => { type: string; sub: Array<{ match: RegExp; sub: string }> }); + | ((code: string) => { + type: string; + sub: Array<{ match: RegExp; sub: string | Promise }> + }); }; export type ShjLanguageDefinition = Array; @@ -98,7 +101,7 @@ export declare function highlightElement( * Call highlightElement on element with a css class starting with `shj-lang-` * @param opt Customization options */ -export declare function HighlightAll(opt?: ShjOptions): Promise; +export declare function highlightAll(opt?: ShjOptions): Promise; /** * Load a language and add it to the langs object