Skip to content

Commit 320f912

Browse files
⚡ Add types
1 parent 74f41e5 commit 320f912

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/class/HTMLCodeBlockElement.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
export namespace Endgine {
2+
type Options = {
3+
/** Language Mode Name */
4+
language: string,
5+
}
6+
7+
type Result = {
8+
markup: string,
9+
};
10+
11+
export type callback = (src: string, options?: Options) => Result;
12+
}
13+
114
export default class HTMLCodeBlockElement extends HTMLElement {
215
/**
316
* Returns the result of highlighting the received source code string.
@@ -7,12 +20,7 @@ export default class HTMLCodeBlockElement extends HTMLElement {
720
* @param options - Option for highlight
821
* @returns - Object of the highlight result
922
*/
10-
static highlight: (src: string, options?: {
11-
/** Language Mode Name */
12-
language: string,
13-
}) => {
14-
markup: string,
15-
} = () => {
23+
static highlight: Endgine.callback = () => {
1624
throw new TypeError('The syntax highlighting engine is not set to `HTMLCodeBlockElement.highlight`.');
1725
};
1826

0 commit comments

Comments
 (0)