Skip to content

Instantly share code, notes, and snippets.

@joetastic
Last active December 14, 2018 18:36
Show Gist options
  • Save joetastic/199c4eb6b94297a10646506ceaee563b to your computer and use it in GitHub Desktop.
Save joetastic/199c4eb6b94297a10646506ceaee563b to your computer and use it in GitHub Desktop.
import * as React from "react";
type TypeA = 'TypeA';
type TypeB = 'TypeB';
interface WithA {
propertyA: TypeA
}
interface WithAB {
propertyA: TypeA
propertyB: TypeB
}
const withB = <P extends WithAB>(
Component: React.ComponentType<P>
) => (props: WithA) => (
<Component {...props} propertyB={'TypeB'} />
);
@joetastic
Copy link
Author

Compiles in 3.1.6, error in 3.2.1
Type '{ propertyB: "TypeB"; propertyA: "TypeA"; }' is not assignable to type 'IntrinsicAttributes & P & { children?: ReactNode; }'. Property 'propertyB' does not exist on type 'IntrinsicAttributes & P & { children?: ReactNode; }'.

@joetastic
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment