I had this error on a Typescript project, which was actually a beginners mistake.
error TS1002: Unterminated string literal.
const text = 'Lorem ipsum dolor
You have to close the string literal with an ending '
:
const text = 'Lorem ipsum dolor';
If you want to support multiline text, then you would have to use string concatenation:
The concat() is an inbuilt function in TypeScript which is used to add two or more strings and returns a new single string.
Syntax:
string.concat(string2, string3[, ..., stringN]);
const text = 'Lorem ipsum dolor, ' +
'sed diam nonumy eirmod tempor.';
Another solution would be using a template literal:
const text = `Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor .`;