Skip to content

Trimmed leading and trailing spaces when reading string literals after "[" and added a test case.#62144

Closed
falshami2002 wants to merge 2 commits intomicrosoft:mainfrom
falshami2002:my-branch
Closed

Trimmed leading and trailing spaces when reading string literals after "[" and added a test case.#62144
falshami2002 wants to merge 2 commits intomicrosoft:mainfrom
falshami2002:my-branch

Conversation

@falshami2002
Copy link
Copy Markdown

Fixes #62101

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jul 29, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jul 29, 2025
@falshami2002
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@falshami2002
Copy link
Copy Markdown
Author

It looks like one check failed, but the logs indicate "429 (Too many requests)". This is my first contribution, so let me know if anything is needed on my end, or if there was anything I could do better. Thank you for your time.

@DanielRosenwasser
Copy link
Copy Markdown
Member

I'm not sure how the name includes spaces to begin with. Does this do "the right thing" if there is a comment on either side of the string?

@falshami2002
Copy link
Copy Markdown
Author

@DanielRosenwasser I double checked with test cases of [ "x" ] and [ /--comment1--/ "x" /--comment2--/]. Everything appears to work correctly. It looks like symbolName begins as: ["x" ]. After going through the if statement in line 8860, we end up with substring(1, len - 1) which ends up being "x"/space/. When we trim before passing into stripQuotes in the if block starting at line 8865, it allows stripQuotes to function correctly. stripQuotes checks for name.charCodeAt(0) === name.charCodeAt(length - 1), so if we don't strip, we are comparing " to /space/ and it just returns the original string, without stripping. createStringLiteral then adds it's own quotes on top of that and escapes the existing ones, giving us the output in the issue.

@i-ayushh18
Copy link
Copy Markdown

🤖 AI Assistant: Task completed: PR #62144: Trimmed leading and trailing spaces when reading string literals after "[" and added a te...

1 similar comment
@i-ayushh18
Copy link
Copy Markdown

🤖 AI Assistant: Task completed: PR #62144: Trimmed leading and trailing spaces when reading string literals after "[" and added a te...

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Adding a space after the string literal in a computed property name causes an incorrect hover display

5 participants