fix(types): InventoryView - explicit NetObject type on map callback
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { AppLayout } from '../components/AppLayout';
|
import { AppLayout } from '../components/AppLayout';
|
||||||
import { fetchObjects } from '../lib/api';
|
import { fetchObjects } from '../lib/api';
|
||||||
import type { ViewKey } from '../types';
|
import type { NetObject, ViewKey } from '../types';
|
||||||
|
|
||||||
export function InventoryView({ onNavigate }: { onNavigate: (v: ViewKey) => void }) {
|
export function InventoryView({ onNavigate }: { onNavigate: (v: ViewKey) => void }) {
|
||||||
const [objects, setObjects] = useState<Awaited<ReturnType<typeof fetchObjects>>>([]);
|
const [objects, setObjects] = useState<NetObject[]>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchObjects().then(setObjects);
|
fetchObjects().then(setObjects);
|
||||||
@@ -32,7 +32,7 @@ export function InventoryView({ onNavigate }: { onNavigate: (v: ViewKey) => void
|
|||||||
<td colSpan={5} className="empty">Nessun oggetto</td>
|
<td colSpan={5} className="empty">Nessun oggetto</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
{objects.map(o => (
|
{objects.map((o: NetObject) => (
|
||||||
<tr key={o.id}>
|
<tr key={o.id}>
|
||||||
<td>{o.name}</td>
|
<td>{o.name}</td>
|
||||||
<td>{o.type}</td>
|
<td>{o.type}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user