Skip to content

Inline variable with string literals should merge with template strings #54755

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
DanielRosenwasser opened this issue Jun 23, 2023 · 0 comments · Fixed by #54849
Closed

Inline variable with string literals should merge with template strings #54755

DanielRosenwasser opened this issue Jun 23, 2023 · 0 comments · Fixed by #54849
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@DanielRosenwasser
Copy link
Member

const pizza = "🍕";
export const prompt = `Hello, would you like some ${pizza}?`;

Trigger "inline variable" on pizza.

Current:

export const prompt = `Hello, would you like some ${"🍕"}?`;

Expected:

export const prompt = `Hello, would you like some 🍕?`;

Beware of inlining strings with backticks.

const codeText = "Code-formatted text looks `like this` and requires surrounding by backticks (\\`).";
export const mdTutorial = `Let's talk about markdown.\n${codeText}?`;
@DanielRosenwasser DanielRosenwasser changed the title Inline variable with string literals should reconstruct concatenations Inline variable with string literals should merge with template strings Jun 23, 2023
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this Experience Enhancement Noncontroversial enhancements labels Jun 26, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants