Default props should be {}, not undefined or void

This commit is contained in:
Tanguy Krotoff
2017-06-29 14:00:18 +02:00
parent 51e7287c86
commit 552051f56f
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ export interface RouteConfigComponentProps<T> extends RouteComponentProps<T> {
export interface RouteConfig {
location?: Location;
component?: React.ComponentType<RouteConfigComponentProps<any> | void>;
component?: React.ComponentType<RouteConfigComponentProps<any> | {}>;
path?: string;
exact?: boolean;
strict?: boolean;
+1 -1
View File
@@ -64,7 +64,7 @@ export interface RouteComponentProps<P> {
export interface RouteProps {
location?: H.Location;
component?: React.ComponentType<RouteComponentProps<any> | undefined>;
component?: React.ComponentType<RouteComponentProps<any> | {}>;
render?: ((props: RouteComponentProps<any>) => React.ReactNode);
children?: ((props: RouteComponentProps<any>) => React.ReactNode) | React.ReactNode;
path?: string;
@@ -22,7 +22,7 @@ const PreventingTransitionsExample = () => (
</Router>
);
class Form extends React.Component<undefined, {isBlocking: boolean}> {
class Form extends React.Component<{}, {isBlocking: boolean}> {
state = {
isBlocking: false
};
+2 -2
View File
@@ -24,8 +24,8 @@ export interface WithScrollOptions {
export type ComponentConstructor<Props> = React.ComponentType<Props>;
export function withScroll(component: ComponentConstructor<RouteComponentProps<any> | undefined>, options?: WithScrollOptions)
: ComponentConstructor<RouteComponentProps<any> | undefined>;
export function withScroll(component: ComponentConstructor<RouteComponentProps<any> | {}>, options?: WithScrollOptions)
: ComponentConstructor<RouteComponentProps<any> | {}>;
export type RouteConfiguration = RouteProps & { inject?: { [key: string]: any } };