react-overrides
Version:
Helper for create reusable components through Overrides Pattern
97 lines (93 loc) • 2.17 kB
Flow
// @flow
import * as React from "react";
import o, { type ExtractOverridesProps } from "..";
declare var Option: (props: {
a: 1 | 2,
b: string,
}) => any;
declare var Container: (props: {
children?: React.Node
}) => any;
const OverridableProps = {
Option,
Container
};
type TOverridesProps = ExtractOverridesProps<typeof OverridableProps>;
declare var Select: (props: {
overrides: TOverridesProps
}) => any;
/**
* $ExpectError
* Pass prop wrong prop value
*/
declare var SelectWrongProp: (props: {
overrides: TOverridesProps
}) => any;
declare var OverridedSelect: () => any;
declare var OverridedSelectPartialProps: () => any;
declare var OverridedSelectPartialComponents: () => any;
/**
* $ExpectError
* prettier-ignore
* Pass prop wrong prop value
*/
declare var OverridedWrongProp: () => any;
declare var NewOption: (props: {
a: 1 | 2,
b: string,
}) => any;
declare var OverridedSelectNewComponent: () => any;
declare var NewOptionPartial: (props: {
b: number | string
}) => any;
declare var OverridedNewComponentPartial: () => any;
/**
* $ExpectError
* prettier-ignore
* Pass incompatible component
*/
declare var Option11: (props: {
a: 1 | 2,
b: string,
}) => any;
declare var Container11: (props: {
children?: React.Node
}) => any;
const OverridableProps11 = {
Option11,
Container11
};
type TOverridesProps11 = ExtractOverridesProps<typeof OverridableProps11>;
declare var Select11: (props: {
overrides: TOverridesProps11
}) => any;
declare var NewOptionWrong: (props: {
b: number
}) => any;
declare var OverridedNewComponentWrong: () => any;
/**
* $ExpectError
* prettier-ignore
* Pass incompatible component
*/
declare var Option22: (props: {
a: 1 | 2,
b: string,
}) => any;
declare var Container22: (props: {
children?: React.Node
}) => any;
const OverridableProps22 = {
Option22,
Container22
};
type TOverridesProps22 = ExtractOverridesProps<typeof OverridableProps22>;
declare var Select22: (props: {
overrides: TOverridesProps22
}) => any;
declare var NewOptionWrongExtra: (props: {
a: 1 | 2,
b: string,
c: string,
}) => any;
declare var OverridedNewComponentWrongExtra: () => any;