Skip to content

Instantly share code, notes, and snippets.

@istarkov
Last active September 3, 2017 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save istarkov/d0f3bef0a7349b5e62289abe0fa5cd77 to your computer and use it in GitHub Desktop.
Save istarkov/d0f3bef0a7349b5e62289abe0fa5cd77 to your computer and use it in GitHub Desktop.
// change output type of withProps
// from `HOC<A & B, B>` to `HOC<{ ...$Exact<B>, ...A }, B>`
type EnhancedCompProps = { b: number }
const enhancer2: HOC<*, EnhancedCompProps> = compose(
withProps(({ b }) => ({
b: `${b}`,
})),
withProps(({ b }) => ({
// $ExpectError The operand of an arithmetic operation must be a number
c: 1 * b,
}))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment