chore(admin-ui): fix pre-existing TypeScript errors
5 ошибок TS, накопленных за прошлые итерации — теперь pnpm tsc зелёный: - SchemaDrivenForm: убран unused import formatIsoDateTime + unused prop `path` (передавался в FieldRenderer, но FieldRendererProps его не объявлял и FieldBody не использовал) - dictionaries.$name: удалена неиспользуемая функция toIsoDate - api/client.ts: добавлен `$schema?: string` в JsonSchema type (используется в buildSchemaJson и тестируется в types.test.ts)
This commit is contained in:
@@ -41,6 +41,7 @@ export type DictionaryDefinition = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type JsonSchema = {
|
export type JsonSchema = {
|
||||||
|
$schema?: string
|
||||||
type?: string
|
type?: string
|
||||||
title?: string
|
title?: string
|
||||||
description?: string
|
description?: string
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import {
|
|||||||
combineDateTime,
|
combineDateTime,
|
||||||
extractTime,
|
extractTime,
|
||||||
formatIsoDate,
|
formatIsoDate,
|
||||||
formatIsoDateTime,
|
|
||||||
parseFormDate,
|
parseFormDate,
|
||||||
} from '@/lib/dates'
|
} from '@/lib/dates'
|
||||||
|
|
||||||
@@ -217,7 +216,6 @@ export const SchemaDrivenForm = ({
|
|||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
key={key}
|
key={key}
|
||||||
fieldKey={key}
|
fieldKey={key}
|
||||||
path={`data.${key}`}
|
|
||||||
schema={properties[key]}
|
schema={properties[key]}
|
||||||
required={required.has(key)}
|
required={required.has(key)}
|
||||||
control={control}
|
control={control}
|
||||||
@@ -236,7 +234,6 @@ export const SchemaDrivenForm = ({
|
|||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
key={key}
|
key={key}
|
||||||
fieldKey={key}
|
fieldKey={key}
|
||||||
path={`data.${key}`}
|
|
||||||
schema={properties[key]}
|
schema={properties[key]}
|
||||||
required={required.has(key)}
|
required={required.has(key)}
|
||||||
control={control}
|
control={control}
|
||||||
@@ -255,7 +252,6 @@ export const SchemaDrivenForm = ({
|
|||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
key={key}
|
key={key}
|
||||||
fieldKey={key}
|
fieldKey={key}
|
||||||
path={`data.${key}`}
|
|
||||||
schema={properties[key]}
|
schema={properties[key]}
|
||||||
required={required.has(key)}
|
required={required.has(key)}
|
||||||
control={control}
|
control={control}
|
||||||
|
|||||||
@@ -344,15 +344,6 @@ function DictionaryDetail() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const toIsoDate = (iso: string | undefined): string => {
|
|
||||||
if (!iso) return ''
|
|
||||||
const d = new Date(iso)
|
|
||||||
if (isNaN(d.getTime())) return ''
|
|
||||||
if (d.getFullYear() >= 9999) return ''
|
|
||||||
const pad = (n: number) => String(n).padStart(2, '0')
|
|
||||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const serverErrorMessage = (err: unknown): string | null => {
|
const serverErrorMessage = (err: unknown): string | null => {
|
||||||
if (!err) return null
|
if (!err) return null
|
||||||
if (axios.isAxiosError(err)) {
|
if (axios.isAxiosError(err)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user