Guest User

Untitled

a guest
Jan 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import * as React from 'react';
  2.  
  3. type ComponenProps = {
  4. a: string;
  5. };
  6.  
  7. export function withLikeActions<T extends ComponenProps>(Component: React.ComponentType<T>): React.SFC<T> {
  8. return (props: T) => (
  9. <Component {...props} />
  10. );
  11. }
  12.  
  13. // first
  14. type arrProps = {
  15. a: number;
  16. };
  17.  
  18. const arr: React.SFC<arrProps> = () => (<div>text</div>);
  19.  
  20. // err
  21. withLikeActions(arr);
  22.  
  23. // second
  24. type arrProps2 = {
  25.  
  26. };
  27.  
  28. const arr2: React.SFC<arrProps2> = () => (<div>text</div>);
  29.  
  30. // success
  31. withLikeActions(arr2);
Add Comment
Please, Sign In to add comment