i18next-parser icon indicating copy to clipboard operation
i18next-parser copied to clipboard

Cannot read property 'text' of undefined in jsx-lexer

Open tsuz opened this issue 4 years ago • 2 comments

🐛 Bug Report

Same behavior as https://github.com/i18next/i18next-parser/issues/199 where the spread operator generates an error using i18next CLI on v4.1.1

To Reproduce

import React from 'react';
import PropTypes from 'prop-types';
import { withTranslation, Trans } from 'react-i18next';

// Refer to https://react.i18next.com/latest/trans-component#alternative-usage-components-array
const Component = (props) => {
  return <Trans {...props}>{props.children}</Trans>;
};

Component.propTypes = {
  children: PropTypes.node.isRequired
};

export default withTranslation()(Component);

Once I remove the {...props}, then this error disappears.

Expected behavior

There should be no error.

Your Environment

  • runtime version: i.e. node v12.21
  • i18next version: i.e. 19.5.3
  • os: Mac
  • any other relevant information: the workaround is to remove the spread operator.

tsuz avatar Jul 01 '21 08:07 tsuz

same for me. I also identified the spread operator to be the problem

beuluis avatar Oct 01 '21 07:10 beuluis

i am on version 4.7.0

beuluis avatar Oct 01 '21 07:10 beuluis

Deployed as part of 6.6.0

karellm avatar Oct 05 '22 13:10 karellm