Skip to content
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

Changes functionality with string templates containing new lines #8

Open
guitarislife87 opened this issue Jul 3, 2018 · 0 comments

Comments

@guitarislife87
Copy link

When trying to add this to one of our projects, I noticed the library changing the behavior of several of our classes that format strings. Digging into the output code, it appears that tspath is adding a semicolon immediately after return when returning a string template, so, return ` would become return;` . I created a test case to replicate the behavior.

Source:

class TestClass {

        public getString(): string {
                const content = `
                        Do something
                `;
                this._notUsed(content);
                return this._getString(content);
        }

        private _notUsed(value: string): string {
                return `
                        ${value}
               `;

        }

        private _getString(value: string): string {
                return `
                        This ${value} is on the next line
                `;
        }
}

console.log(new TestClass().getString());

Expected:


                        This 
                        Do something
                 is on the next line

Returned:
undefined

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

No branches or pull requests

1 participant