From be721c5bcb0b05d484294cc53bed95ae8a3e2f9e Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Mon, 30 Nov 2020 12:00:54 +0000 Subject: [PATCH] Create TS compatible version of replaceableComponent --- src/utils/replaceableComponent.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/replaceableComponent.ts b/src/utils/replaceableComponent.ts index 8c29fdf037..f83e0c95c1 100644 --- a/src/utils/replaceableComponent.ts +++ b/src/utils/replaceableComponent.ts @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +import { func } from 'prop-types'; import * as React from 'react'; import * as sdk from '../index'; @@ -38,3 +39,12 @@ export function replaceableComponent(name: string, origComponent: React.Componen // return a falsey value like `null` when the skin doesn't have a component. return () => sdk.getComponent(name) || origComponent; } + +/** + * Typescript-compatible version of `replaceableComponent` + * @see replaceableComponent + * @param {string} name The dot-path name of the component being replaced. + */ +export function replaceableComponentTs(name: string) { + return (origComponent: typeof React.Component) => sdk.getComponent(name) || origComponent; +} \ No newline at end of file