docs: 全文档合规检查与修正 - 代码示例规范/行数准确性/路径一致性/状态同步

This commit is contained in:
SpecialX
2026-06-18 03:31:07 +08:00
parent 0423b2b984
commit 4d659ad9a1
18 changed files with 595 additions and 522 deletions

View File

@@ -127,10 +127,10 @@ import { useTransition } from "react"
import { toast } from "sonner"
import type { ActionState } from "@/shared/types/action-state"
export function useActionWithToast<T>() {
export function useActionWithToast<T>(): { isPending: boolean; execute: (action: () => Promise<ActionState<T>>) => Promise<void> } {
const [isPending, startTransition] = useTransition()
const execute = async (action: () => Promise<ActionState<T>>) => {
const execute = async (action: () => Promise<ActionState<T>>): Promise<void> => {
startTransition(async () => {
const result = await action()
if (result.success) {
@@ -362,7 +362,7 @@ import rehypeSanitize from "rehype-sanitize"
#### 方案
```typescript
export function formatDate(date: string | Date, locale = "zh-CN") {
export function formatDate(date: string | Date, locale = "zh-CN"): string {
return new Intl.DateTimeFormat(locale, {
year: "numeric",
month: "short",