SMotaal / polyestr-tsx-lit-transform

A TypeScript TSX-to-template-literal transform that builds into the eco-system of Polyestr.
3 stars 0 forks source link

[Bug]: transformation produces invalid code if JSX fragments do not contain at least one expression! #5

Open SMotaal opened 7 years ago

SMotaal commented 7 years ago

Version: 1.0.0-alpha.2

Input:

  const okay = html(<p>{'text'}</p>);
  const not = html(<p>text</p>);

Expected Output:

  const okay = html `<p>${'text'}</p>`;
  const not = html `<p>text</p>`;

Actual Output:

  const okay = html `<p>${'text'}</p>`;
  const not = html `<p>text</p>${;

Possible Cause:

Transformation does not account for the fact that values will potentially be empty (when there is only 1 string).