Last active
August 28, 2018 22:02
-
-
Save hasparus/91c4573c5ab4bdc73e3d3494d35add68 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 { ComponentClass, ComponentType, Ref } from 'react'; | |
export type Fixture<T extends ComponentType<any>> = { | |
component: T; | |
init?: (arg: { compRef: Ref<T> }) => Promise<any>; | |
name?: string; | |
namespace?: string; | |
props: T extends ComponentType<infer X> ? X : never; | |
state?: T extends ComponentClass<any, infer S> ? S : never; | |
}; | |
export function createFixture<T extends ComponentType<any>>( | |
fixture: Fixture<T> | |
): Fixture<T> { | |
return fixture; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment