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

Omit String(value) in interpolated string JS output when value is already string #4293

Closed
sgrove opened this issue Apr 9, 2020 · 0 comments

Comments

@sgrove
Copy link

sgrove commented Apr 9, 2020

This reason:

let appId = "7323b2d5-e423-4b18-ad93-31e53f190baa";
let oneGraphUrl = {j|https://serve.onegraph.io/graphql?app_id=$appId|j};

outputs this javascript:

var appId = "7323b2d5-e423-4b18-ad93-31e53f190baa";
var oneGraphUrl = "https://serve.onegraph.io/graphql?app_id=" + (String(appId) + "");

If the type of appId is known to be string (or an alias of string/abstract string), is it possible that in the output of

{j|https://serve.onegraph.io/graphql?app_id=$appId|j}

we could omit the + (String(appId) + "") and instead output

"https://serve.onegraph.io/graphql?app_id=" + appId;

bobzhang added a commit that referenced this issue Apr 15, 2020
fix #4293 -- better output for string interpolation
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