-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Polymorphic box has partialized props if "as" component has unioned props.
Reproduction
import React from 'react';
import { Box } from 'react-polymorphic-box';
interface ITestA {
value: 'a';
}
interface ITestB {
value: 'b';
extra: string;
}
type Test = ITestA | ITestB;
const Test: React.FC<Test> = (props) => {
return <></>;
};
function App() {
return (
<>
<Test value="b" extra="extra" />
<Box as={Test} value="b" extra="extra" />
</>
);
}
Expected behavior
Polymorphic box has correct props types.
Actual behavior
Type '{ as: FC<Test>; value: "b"; extra: string; }' is not assignable to type 'IntrinsicAttributes & BoxOwnProps<FC<Test>> & Pick<PropsWithChildren<Test>, "value" | "children">'. Property 'extra' does not exist on type 'IntrinsicAttributes & BoxOwnProps<FC<Test>> & Pick<PropsWithChildren<Test>, "value" | "children">'
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
