فهرست منبع

add strict types

reiji-h 1 سال پیش
والد
کامیت
2b40ee5695
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      apps/app/src/services/renderer/rehype-plugins/relocate-toc.ts

+ 4 - 4
apps/app/src/services/renderer/rehype-plugins/relocate-toc.ts

@@ -1,6 +1,6 @@
-import rehypeToc, { type HtmlElementNode } from 'rehype-toc';
+import rehypeToc from 'rehype-toc';
+import type { HtmlElementNode } from 'rehype-toc';
 import type { Plugin } from 'unified';
 import type { Plugin } from 'unified';
-import type { Node } from 'unist';
 
 
 type StoreTocPluginParams = {
 type StoreTocPluginParams = {
   storeTocNode: (toc: HtmlElementNode) => void,
   storeTocNode: (toc: HtmlElementNode) => void,
@@ -22,13 +22,13 @@ export const rehypePluginStore: Plugin<[StoreTocPluginParams]> = (options) => {
 
 
 
 
 // method for replace <ol> to <ul>
 // method for replace <ol> to <ul>
-const replaceOlToUl = (children: Node[]) => {
+const replaceOlToUl = (children: HtmlElementNode[]) => {
   children.forEach((child) => {
   children.forEach((child) => {
     if (child.type === 'element' && child.tagName === 'ol') {
     if (child.type === 'element' && child.tagName === 'ol') {
       child.tagName = 'ul';
       child.tagName = 'ul';
     }
     }
     if (child.children != null) {
     if (child.children != null) {
-      replaceOlToUl(child.children as Node[]);
+      replaceOlToUl(child.children as HtmlElementNode[]);
     }
     }
   });
   });
 };
 };