Create TS compatible version of replaceableComponent
parent
b870de14ed
commit
be721c5bcb
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue