Cleanup AppRegistry types

Summary:
Found some missing/wrong types when playing around with the AppRegistry for routing work in the main app.
This commit is contained in:
Pieter De Baets 2015-07-29 09:53:13 -07:00
parent e073fdc4c7
commit d6de865236
1 changed files with 5 additions and 2 deletions

View File

@ -22,9 +22,11 @@ if (__DEV__) {
var runnables = {};
type ComponentProvider = () => ReactClass<any, any, any>;
type AppConfig = {
appKey: string;
component: ReactClass<any, any, any>;
component?: ComponentProvider;
run?: Function;
};
@ -46,12 +48,13 @@ var AppRegistry = {
if (appConfig.run) {
AppRegistry.registerRunnable(appConfig.appKey, appConfig.run);
} else {
invariant(appConfig.component, 'No component provider passed in');
AppRegistry.registerComponent(appConfig.appKey, appConfig.component);
}
}
},
registerComponent: function(appKey: string, getComponentFunc: Function): string {
registerComponent: function(appKey: string, getComponentFunc: ComponentProvider): string {
runnables[appKey] = {
run: (appParameters) =>
renderApplication(getComponentFunc(), appParameters.initialProps, appParameters.rootTag)