I had this error on a Typescript project, which was actually a beginners mistake.

How to fix errorTS1002

error TS1002: Unterminated string literal.

Before

const text = 'Lorem ipsum dolor

After

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 .`;

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!