diff --git a/src/internal/utils/external-props.ts b/src/internal/utils/external-props.ts index a104b5f572..1128919f6b 100644 --- a/src/internal/utils/external-props.ts +++ b/src/internal/utils/external-props.ts @@ -5,11 +5,11 @@ * Method to filter out internal properties prefixed by "__" */ export const getExternalProps = >(props: T): T => { - const externalPropNames = Object.keys(props).filter( - (propName: string) => propName.indexOf('__') !== 0 - ) as (keyof T)[]; - return externalPropNames.reduce>((acc: Partial, propName: keyof T) => { - acc[propName] = props[propName]; - return acc; - }, {}) as T; + const externalProps: Partial = {}; + for (const propName in props) { + if (!propName.startsWith('__')) { + externalProps[propName] = props[propName]; + } + } + return externalProps as T; };