From 92af111c930a067af0a287338f173cb1b876fb3e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 8 Mar 2021 19:19:52 -0700 Subject: [PATCH] Fix types for replaceableComponent This is to make it work in TS files --- src/utils/replaceableComponent.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/replaceableComponent.ts b/src/utils/replaceableComponent.ts index 8c29fdf037..f8dd5f8ac6 100644 --- a/src/utils/replaceableComponent.ts +++ b/src/utils/replaceableComponent.ts @@ -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.