Fix types for replaceableComponent

This is to make it work in TS files
This commit is contained in:
Travis Ralston 2021-03-08 19:19:52 -07:00
parent b12cf7912a
commit 92af111c93

View File

@ -30,9 +30,11 @@ import * as sdk from '../index';
* @param {string} name The dot-path name of the component being replaced.
* @param {React.Component} origComponent The component that can be replaced
* with a skinned version. If no skinned version is available, this component
* will be used.
* will be used. Note that this is automatically provided to the function and
* thus is optional for purposes of types.
* @returns {ClassDecorator} The decorator.
*/
export function replaceableComponent(name: string, origComponent: React.Component) {
export function replaceableComponent(name: string, origComponent?: React.Component): ClassDecorator {
// Decorators return a function to override the class (origComponent). This
// ultimately assumes that `getComponent()` won't throw an error and instead
// return a falsey value like `null` when the skin doesn't have a component.