Skip to content

Commit

Permalink
Add NavigationFunctionComponent interface (#6249)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Elizabeth Martín Campos authored Jun 9, 2020
1 parent 469e69f commit c56630e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export * from './interfaces/Options';
export * from './interfaces/NavigationComponent';
export * from './interfaces/NavigationComponentProps';
export * from './interfaces/NavigationComponentListener';
export * from './interfaces/NavigationFunctionComponent';
8 changes: 8 additions & 0 deletions lib/src/interfaces/NavigationFunctionComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import { NavigationComponentProps } from './NavigationComponentProps';
import { Options } from './Options';

export interface NavigationFunctionComponent<Props = {}>
extends React.FunctionComponent<Props & NavigationComponentProps> {
options?: ((props: Props) => Options) | Options;
}

0 comments on commit c56630e

Please sign in to comment.