Commit 7f7d57b
Changed files (2)
src
components
comment
src/components/comment/Twikoo.astro
@@ -8,8 +8,6 @@ import { CDN } from '@constants/cdn.mjs';
<script>
import { commentConfig } from '@/config';
const twikooConfig = commentConfig.twikoo;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- declare const twikoo: any;
function setup() {
if (typeof twikoo === 'undefined') {
@@ -17,7 +15,7 @@ import { CDN } from '@constants/cdn.mjs';
} else {
twikoo.init({
el: '#twikoo-wrap',
- ...twikooConfig,
+ ...twikooConfig!,
});
}
}
src/global.d.ts
@@ -4,4 +4,39 @@ declare global {
interface Window {
swup: Swup;
}
+
+ const twikoo: {
+ init: (options: {
+ envId: string;
+ el: string;
+ region?: string;
+ path?: string;
+ lang?: string;
+ onCommentLoaded?: () => void;
+ }) => Promise<void>;
+ getCommentsCount: (options: {
+ envId: string;
+ urls: string[];
+ includeReply?: boolean;
+ }) => Promise<{ url: string; count: number }[]>;
+ getRecentComments: (options: {
+ envId: string;
+ urls?: string[];
+ pageSize?: number;
+ includeReply?: boolean;
+ }) => Promise<
+ {
+ id: string;
+ url: string;
+ nick: string;
+ mailMd5: string;
+ link: string;
+ comment: string;
+ commentText: string;
+ created: number;
+ avatar: string;
+ relativeTime: string;
+ }[]
+ >;
+ };
}