From f0e15f5a3ac04d72b373fd448a72cdc923341823 Mon Sep 17 00:00:00 2001 From: TaPiOn Date: Wed, 22 Mar 2023 10:14:23 +0400 Subject: [PATCH] Make links menu optional No problem when you declare your HeaderActionProps in json but got an error in editor when you declare in js. By setting it optional we can create a js file with a const links declaration like this: import { HeaderActionProps } from './HeaderAction'; export const links: HeaderActionProps['links'] = [ --- components/HeaderAction/HeaderAction.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/HeaderAction/HeaderAction.tsx b/components/HeaderAction/HeaderAction.tsx index 4e600211..c5a82c4e 100644 --- a/components/HeaderAction/HeaderAction.tsx +++ b/components/HeaderAction/HeaderAction.tsx @@ -56,7 +56,7 @@ const useStyles = createStyles((theme) => ({ })); interface HeaderActionProps { - links: { link: string; label: string; links: { link: string; label: string }[] }[]; + links: { link: string; label: string; links?: { link: string; label: string }[] }[]; } export function HeaderAction({ links }: HeaderActionProps) {