Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove deprecated defaultProps #277

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Case.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ import type { ComponentWithConditionPropsWithFunctionChildren } from './types';
* @param props The props to pass down to the `<Case />` component
*/
export const Case: FC<ComponentWithConditionPropsWithFunctionChildren> = (props) => render(props);

Case.defaultProps = {
children: null
};
4 changes: 0 additions & 4 deletions src/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ import type { FCWithImplicitChildren } from './types';
* @param props The props to pass down to the `<Default />` component
*/
export const Default: FCWithImplicitChildren = (props) => render(props);

Default.defaultProps = {
children: null
};
4 changes: 0 additions & 4 deletions src/Unless.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@ export const Unless: FC<ComponentWithConditionPropsWithFunctionChildren> = ({ co

return !conditionResult && children ? render({ children }) : null;
};

Unless.defaultProps = {
children: null
};
4 changes: 0 additions & 4 deletions src/When.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@ export const When: FC<ComponentWithConditionPropsWithFunctionChildren> = ({ cond

return conditionResult && children ? render({ children }) : null;
};

When.defaultProps = {
children: null
};
10 changes: 2 additions & 8 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PropsWithChildren, ReactElement, ReactNode, ValidationMap, WeakValidationMap } from 'react';
import type { FunctionComponent, PropsWithChildren, ReactNode } from 'react';

/**
* Type for a value that can properly be parsed by `Boolean(...)`
Expand Down Expand Up @@ -57,13 +57,7 @@ export type ComponentWithConditionPropsAsyncSupport = ComponentWithConditionProp

export type FCWithImplicitChildren<P = NonNullObject> = FunctionComponentWithImplicitChildren<P>;

export interface FunctionComponentWithImplicitChildren<P = NonNullObject> {
(props: CustomPropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
propTypes?: WeakValidationMap<P> | undefined;
contextTypes?: ValidationMap<any> | undefined;
defaultProps?: Partial<P> | undefined;
displayName?: string | undefined;
}
export type FunctionComponentWithImplicitChildren<P = NonNullObject> = FunctionComponent<CustomPropsWithChildren<P>>;

// eslint-disable-next-line @typescript-eslint/ban-types
export type NonNullObject = {} & object;
Expand Down