Skip to content

String is not compiled successfully in Playground #1287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abdallamourad opened this issue Oct 27, 2020 · 2 comments
Closed

String is not compiled successfully in Playground #1287

abdallamourad opened this issue Oct 27, 2020 · 2 comments
Labels
Playground Issues that affect the Playground

Comments

@abdallamourad
Copy link
Contributor

abdallamourad commented Oct 27, 2020

String in playground does not compile successfully. When there are new lines in string I tried to console log the value, the new lines weren't there.

Code

image
image

Output

image

Repro:

  • Go to Handbook -> Basic Types -> String example Both examples
  • Navigate to playground
  • append console.log(sentence) at the end of the script
  • Click Run
  • The Output does not match the code

Code

let fullName: string = `Bob Bobbington`;
let age: number = 37;
let sentence: string = `Hello, my name is ${fullName}.

I'll be ${age + 1} years old next month.`;

console.log(sentence)
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

Expected behavior:
[LOG]: "Hello, my name is Bob Bobbington.

I'll be 38 years old next month."
Actual behavior:
[LOG]: "Hello, my name is Bob Bobbington. I'll be 38 years old next month."

@abdallamourad abdallamourad added the Playground Issues that affect the Playground label Oct 27, 2020
@orta
Copy link
Contributor

orta commented Oct 27, 2020

Looks like we need to do white-space: pre on the logs to retain white spacing, thanks.

orta added a commit that referenced this issue Oct 27, 2020
@abdallamourad
Copy link
Contributor Author

Thank you! I will close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Playground Issues that affect the Playground
Projects
None yet
Development

No branches or pull requests

2 participants