Last active
December 14, 2018 18:36
-
-
Save joetastic/199c4eb6b94297a10646506ceaee563b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'} /> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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; }'.