fix: use double-cast to resolve TS2352/TS2322 type errors
Named interfaces without index signatures cannot be directly cast to Record<string, unknown>. Use `as unknown as` double-cast to satisfy TypeScript strict mode for the AnyEntity[] and Dispatch casts in ConfigDetail.tsx, and the Config -> Record<string, unknown> cast in ConfigList.tsx. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,8 +53,8 @@ export default function ConfigDetail() {
|
|||||||
const tabConfig = [
|
const tabConfig = [
|
||||||
{
|
{
|
||||||
label: 'Zones',
|
label: 'Zones',
|
||||||
rows: zones as AnyEntity[],
|
rows: zones as unknown as AnyEntity[],
|
||||||
setRows: setZones as Dispatch<SetStateAction<AnyEntity[]>>,
|
setRows: setZones as unknown as Dispatch<SetStateAction<AnyEntity[]>>,
|
||||||
api: zonesApi,
|
api: zonesApi,
|
||||||
columns: [
|
columns: [
|
||||||
{ key: 'name' as const, label: 'Name' },
|
{ key: 'name' as const, label: 'Name' },
|
||||||
@@ -69,8 +69,8 @@ export default function ConfigDetail() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Interfaces',
|
label: 'Interfaces',
|
||||||
rows: interfaces as AnyEntity[],
|
rows: interfaces as unknown as AnyEntity[],
|
||||||
setRows: setInterfaces as Dispatch<SetStateAction<AnyEntity[]>>,
|
setRows: setInterfaces as unknown as Dispatch<SetStateAction<AnyEntity[]>>,
|
||||||
api: interfacesApi,
|
api: interfacesApi,
|
||||||
columns: [
|
columns: [
|
||||||
{ key: 'name' as const, label: 'Interface' },
|
{ key: 'name' as const, label: 'Interface' },
|
||||||
@@ -89,8 +89,8 @@ export default function ConfigDetail() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Policies',
|
label: 'Policies',
|
||||||
rows: policies as AnyEntity[],
|
rows: policies as unknown as AnyEntity[],
|
||||||
setRows: setPolicies as Dispatch<SetStateAction<AnyEntity[]>>,
|
setRows: setPolicies as unknown as Dispatch<SetStateAction<AnyEntity[]>>,
|
||||||
api: policiesApi,
|
api: policiesApi,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
@@ -118,8 +118,8 @@ export default function ConfigDetail() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Rules',
|
label: 'Rules',
|
||||||
rows: rules as AnyEntity[],
|
rows: rules as unknown as AnyEntity[],
|
||||||
setRows: setRules as Dispatch<SetStateAction<AnyEntity[]>>,
|
setRows: setRules as unknown as Dispatch<SetStateAction<AnyEntity[]>>,
|
||||||
api: rulesApi,
|
api: rulesApi,
|
||||||
columns: [
|
columns: [
|
||||||
{ key: 'action' as const, label: 'Action' },
|
{ key: 'action' as const, label: 'Action' },
|
||||||
@@ -152,8 +152,8 @@ export default function ConfigDetail() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Masq/NAT',
|
label: 'Masq/NAT',
|
||||||
rows: masq as AnyEntity[],
|
rows: masq as unknown as AnyEntity[],
|
||||||
setRows: setMasq as Dispatch<SetStateAction<AnyEntity[]>>,
|
setRows: setMasq as unknown as Dispatch<SetStateAction<AnyEntity[]>>,
|
||||||
api: masqApi,
|
api: masqApi,
|
||||||
columns: [
|
columns: [
|
||||||
{ key: 'out_interface' as const, label: 'Out Interface' },
|
{ key: 'out_interface' as const, label: 'Out Interface' },
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export default function ConfigList() {
|
|||||||
open={formOpen}
|
open={formOpen}
|
||||||
title={editing ? 'Edit Config' : 'New Config'}
|
title={editing ? 'Edit Config' : 'New Config'}
|
||||||
fields={FIELDS}
|
fields={FIELDS}
|
||||||
initialValues={editing ?? undefined}
|
initialValues={editing as unknown as Record<string, unknown> ?? undefined}
|
||||||
onClose={() => { setFormOpen(false); setEditing(null) }}
|
onClose={() => { setFormOpen(false); setEditing(null) }}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user