From 330b489fd528b1f80bdbdd1ba1de091fec573cf7 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 28 Jan 2020 16:44:30 +0000 Subject: [PATCH] Switch back to legacy decorators Empirically the build is fine with these, but it is unfortunate that we have to reply on deprecated semantics. TypeScript should help fix this. --- babel.config.js | 2 +- src/utils/replaceableComponent.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/babel.config.js b/babel.config.js index 3c0c3fcb85..d5a97d56ce 100644 --- a/babel.config.js +++ b/babel.config.js @@ -11,7 +11,7 @@ module.exports = { "@babel/preset-react" ], "plugins": [ - ["@babel/plugin-proposal-decorators", {decoratorsBeforeExport: true}], + ["@babel/plugin-proposal-decorators", {legacy: true}], "@babel/plugin-proposal-export-default-from", "@babel/plugin-proposal-numeric-separator", "@babel/plugin-proposal-class-properties", diff --git a/src/utils/replaceableComponent.ts b/src/utils/replaceableComponent.ts index 281ff4c1ac..9f617b27f3 100644 --- a/src/utils/replaceableComponent.ts +++ b/src/utils/replaceableComponent.ts @@ -32,13 +32,9 @@ import * as sdk from '../index'; * with a skinned version. If no skinned version is available, this component * will be used. */ -export function replaceableComponent(name: string) { +export function replaceableComponent(name: string, origComponent: React.Component) { // 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. - return (origComponent) => { - const c = sdk.getComponent(name) || origComponent; - c.kind = "class"; // appeases babel - return c; - }; + return () => sdk.getComponent(name) || origComponent; }