Skip to content

Commit

Permalink
fix: update tsconfig for build error
Browse files Browse the repository at this point in the history
  • Loading branch information
escwxyz committed Aug 28, 2024
1 parent 4727d30 commit a5deaef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
31 changes: 16 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ import {
* Callout object with callout type as its key and icon as its value
* @date 3/23/2023 - 5:16:27 PM
*
* @typedef {Callout}
*/
type Callout = Record<string, unknown>;

interface ExtendedNode extends Node {
data?: {
hProperties?: Record<string, unknown>;
};
}
interface HtmlNode extends Node {
type: "html";
data: Data;
Expand All @@ -38,7 +42,6 @@ interface HtmlNode extends Node {
*
* @export
* @interface Config
* @typedef {Config}
*/
export interface Config {
/**
Expand Down Expand Up @@ -183,9 +186,9 @@ function containsKey(obj: Callout, str: string): boolean {
* @date 3/23/2023 - 5:16:26 PM
*
* @param {?Partial<Config>} [customConfig]
* @returns {(tree: any) => void}
* @returns {(tree: Node) => void}
*/
const plugin: Plugin = (customConfig?: Partial<Config>) => {
const plugin: Plugin = (customConfig?: Partial<Config>): (tree: Node) => void => {
const mergedConfig = {
...defaultConfig,
...customConfig,
Expand All @@ -208,8 +211,8 @@ const plugin: Plugin = (customConfig?: Partial<Config>) => {
titleTextTransform,
} = mergedConfig;

return function (tree) {
visit(tree, "blockquote", (node: Node) => {
return function (tree: Node): void {
visit(tree, "blockquote", (node: ExtendedNode) => {
if (!("children" in node) || (node as Parent).children.length == 0)
return;

Expand Down Expand Up @@ -238,15 +241,13 @@ const plugin: Plugin = (customConfig?: Partial<Config>) => {
data: {},
value: `
<div class="${titleClass}">
<${iconTagName} class="${iconClass}">${
callouts[calloutType.toLowerCase()]
}</${iconTagName}>
${
title &&
`<${titleTextTagName} class="${titleTextClass}">${titleTextTransform(
title
)}</${titleTextTagName}>`
}
<${iconTagName} class="${iconClass}">${callouts[calloutType.toLowerCase()]
}</${iconTagName}>
${title &&
`<${titleTextTagName} class="${titleTextClass}">${titleTextTransform(
title
)}</${titleTextTagName}>`
}
</div>
${remainingContent && `<div class="${contentClass}">${remainingContent}</div>`}`,
};
Expand Down
10 changes: 8 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"include": ["src", "test"],
"include": [
"src",
"test"
],
"compilerOptions": {
"lib": ["ESNext"],
"lib": [
"ESNext",
"dom"
],
"module": "ESNext",
"target": "ESNext",
"strict": true,
Expand Down

0 comments on commit a5deaef

Please sign in to comment.