Add Component<P> class

This allows declaring a parameter or variable as a general "component with props P" instead of needing to declare it class based or function.
This commit is contained in:
Cameron Little
2017-05-24 09:34:25 -07:00
committed by GitHub
parent 6d51c94538
commit a524192bf5

View File

@@ -26,6 +26,7 @@ declare namespace React {
// ----------------------------------------------------------------------
type ReactType = string | ComponentClass<any> | StatelessComponent<any>;
type Component<P> = ComponentClass<P> | StatelessComponent<P>;
type Key = string | number;
type Ref<T> = string | ((instance: T) => any);