From c56630e1ca7ed6575ac49c0c0c53a32b7ac3ff05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elizabeth=20Mart=C3=ADn=20Campos?= Date: Tue, 9 Jun 2020 12:49:40 +0200 Subject: [PATCH] Add NavigationFunctionComponent interface (#6249) Added NavigationFunctionComponent interface This interface can be used instead of React.FunctionComponent, fixing Typescript Property 'options' does not exist on type 'FunctionComponent<{}>' error when trying to declare static options on a functional component. --- lib/src/index.ts | 1 + lib/src/interfaces/NavigationFunctionComponent.ts | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 lib/src/interfaces/NavigationFunctionComponent.ts diff --git a/lib/src/index.ts b/lib/src/index.ts index c565766c720..68928c2c581 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -13,3 +13,4 @@ export * from './interfaces/Options'; export * from './interfaces/NavigationComponent'; export * from './interfaces/NavigationComponentProps'; export * from './interfaces/NavigationComponentListener'; +export * from './interfaces/NavigationFunctionComponent'; diff --git a/lib/src/interfaces/NavigationFunctionComponent.ts b/lib/src/interfaces/NavigationFunctionComponent.ts new file mode 100644 index 00000000000..af44d898e41 --- /dev/null +++ b/lib/src/interfaces/NavigationFunctionComponent.ts @@ -0,0 +1,8 @@ +import React from 'react'; +import { NavigationComponentProps } from './NavigationComponentProps'; +import { Options } from './Options'; + +export interface NavigationFunctionComponent + extends React.FunctionComponent { + options?: ((props: Props) => Options) | Options; +}