Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as React from 'react';
- type ComponenProps = {
- a: string;
- };
- export function withLikeActions<T extends ComponenProps>(Component: React.ComponentType<T>): React.SFC<T> {
- return (props: T) => (
- <Component {...props} />
- );
- }
- // first
- type arrProps = {
- a: number;
- };
- const arr: React.SFC<arrProps> = () => (<div>text</div>);
- // err
- withLikeActions(arr);
- // second
- type arrProps2 = {
- };
- const arr2: React.SFC<arrProps2> = () => (<div>text</div>);
- // success
- withLikeActions(arr2);
Add Comment
Please, Sign In to add comment