Skip to content

Conversation

@HugoDF
Copy link
Owner

@HugoDF HugoDF commented Oct 21, 2024

The correct behaviour could be the current one, that doing ${ { my: 'object' } } throws an error (str.replace is not a function), but at the very least the error should be mor explicit eg. throw new Error('Bad interpolated value, expected type "string" received type "' + typeof rawText + '"').

Initial implementation is to silently serialize the value with JSON.stringify. This is also useful for debugging.

The content that is an object could be

  • an attribute property eg. style="${styles}"
  • or content eg. <div>${myObj}</div>

Is outputting the serialized output the correct thing to do? Or should we be failing loud?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants