refactor: standardize runtime guard patterns with lodash-es (#154)

* refactor(ui): replace runtime type guards with lodash-es predicates

* refactor(runtime): migrate typeof checks to lodash-es in core modules

* refactor(ipc): standardize runtime guards with lodash-es

* test(refactor): align runtime guard checks with lodash-es

* docs(agents): add lodash-es runtime guard skill summary
This commit is contained in:
vin authored and GitHub committed 2026-04-12 11:41:56 +08:00
1 parent 0223e8d807
commit bc35b96b5d
33 files changed
+303 -208

No files matched your search

+2 -2
View File
@@ -71,7 +71,7 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { filter, flatMap, isEmpty, size, sumBy } from 'lodash-es';
import { filter, flatMap, isEmpty, isNumber, size, sumBy } from 'lodash-es';
import {
clampQuotaPercentage,
getQuotaStatus,
@@ -313,7 +313,7 @@ export function CloudAccountList() {
{
onSuccess: (updatedAccount) => {
const credits = updatedAccount.quota?.ai_credits?.credits;
if (typeof credits === 'number') {
if (isNumber(credits)) {
toast({
title: t('cloud.toast.quotaRefreshed'),
description: `AI credits: $${credits.toFixed(2)}`,