🏷 Simplify types

This commit is contained in:
Nikolai R Kristiansen committed 2022-02-14 10:22:01 +01:00
1 parent aa66694fd5
commit 5f332cd365
1 file changed
+4 -6
+4 -6
View File
@@ -3,7 +3,7 @@ import clsx from "clsx";
import React from "react"; import React from "react";
import { useUrlSearchParams } from "use-url-search-params"; import { useUrlSearchParams } from "use-url-search-params";
import { Order, OrderLine, OrderListDocument, Transaction, TransactionListDocument } from "../../types"; import { OrderListDocument, TransactionListDocument } from "../../types";
import { formatTime } from "../../utils/time"; import { formatTime } from "../../utils/time";
import styles from "./Log.module.css"; import styles from "./Log.module.css";
@@ -44,13 +44,12 @@ export const Log = () => {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{/* @ts-expect-error The graphql query is not fetching all the fields, so the types are not overlapping */} {orders.map((order) => (
{orders.map((order: Order) => (
<tr key={order.id}> <tr key={order.id}>
<td>{formatTime(order.created)}</td> <td>{formatTime(order.created)}</td>
<td>{order.isExternal ? "Ekstern" : `${order.customer?.firstName} ${order.customer?.lastName}`}</td> <td>{order.isExternal ? "Ekstern" : `${order.customer?.firstName} ${order.customer?.lastName}`}</td>
<td> <td>
{(order.orderlines ?? []).map((line: OrderLine) => ( {(order.orderlines ?? []).map((line) => (
<div key={line.id}> <div key={line.id}>
{line.amount}x {line.product.name} {line.amount}x {line.product.name}
</div> </div>
@@ -101,8 +100,7 @@ export const Log = () => {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{/* @ts-expect-error The graphql query is not fetching all the fields, so the types are not overlapping */} {transactions.map((trans) => (
{transactions.map((trans: Transaction) => (
<tr key={trans.id}> <tr key={trans.id}>
<td>{formatTime(trans.created)}</td> <td>{formatTime(trans.created)}</td>
<td> <td>