From 59f8288addd7bca40e4e80a483a447e9e69bbd83 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL <soullivaneuh@gmail.com> Date: Wed, 23 Mar 2022 19:11:26 +0100 Subject: [PATCH] fix(types): missing resource options label property This aim to solve two things: 1. Using object as type is not recommended as we can not access a property without having Typescript yelling this one can not exist on object (ts2339) 2. As specified on the documentation, the label options is available and use by the react-admin ecosystem. It should be explicitly defined. --- packages/ra-core/src/types.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/ra-core/src/types.ts b/packages/ra-core/src/types.ts index 28a877da587..cbfbeac450b 100644 --- a/packages/ra-core/src/types.ts +++ b/packages/ra-core/src/types.ts @@ -464,6 +464,11 @@ export type ResourceMatch = Match<{ id?: string; }>; +export interface ResourceOptions { + label?: string; + [key: string]: any; +} + export interface ResourceProps { intent?: 'route' | 'registration'; match?: ResourceMatch; @@ -473,7 +478,7 @@ export interface ResourceProps { edit?: ComponentType<ResourceComponentPropsWithId>; show?: ComponentType<ResourceComponentPropsWithId>; icon?: ComponentType<any>; - options?: object; + options?: ResourceOptions; } export interface AdminProps {