Skip to content

Commit 49a6f0e

Browse files
committed
extra overloads
1 parent d8c852d commit 49a6f0e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/compass-components/src/hooks/use-formatted-date.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { formatDate } from '../utils/format-date';
22

33
import { useState, useEffect } from 'react';
44

5+
export function useFormattedDate(timestamp: undefined): undefined;
56
export function useFormattedDate(timestamp: number): string;
7+
export function useFormattedDate(timestamp?: number): string | undefined;
68
export function useFormattedDate(timestamp?: number): string | undefined {
79
const [formattedDate, setFormattedDate] = useState(() =>
810
typeof timestamp === 'number' ? formatDate(timestamp) : undefined

packages/compass-data-modeling/src/components/diagram-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function DiagramCard({
8888
}) {
8989
const darkmode = useDarkMode();
9090
// the hook does support undefined, but the function overload is somehow not transferred here
91-
const formattedDate = useFormattedDate(diagram.lastModified as number);
91+
const formattedDate = useFormattedDate(diagram.lastModified);
9292
return (
9393
<Card
9494
className={diagramCardStyles}

0 commit comments

Comments
 (0)