Skip to content

Use replaceAll instead of an incorrect RegExp for tsserver log sanitization.#54454

Merged
DanielRosenwasser merged 1 commit intomainfrom
sanitizeWithReplaceAll
May 30, 2023
Merged

Use replaceAll instead of an incorrect RegExp for tsserver log sanitization.#54454
DanielRosenwasser merged 1 commit intomainfrom
sanitizeWithReplaceAll

Conversation

@DanielRosenwasser
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser commented May 30, 2023

Today we use the TypeScript version as a raw input string for a RegExp and run it over TSServer logs. But that means that when you switch the version to 5.1.2 a whole bunch of random strings with 5 and 1 and 2 in them are replaced with FakeVersion because we're really running /5.1.2/g over the logs (which is 5{AnyCharacter}1{AnyCharacter}2).

So this PR avoids constructing the incorrect RegExp by using a replaceAll function which uses the newer built-in if it's available.

@DanielRosenwasser
Copy link
Copy Markdown
Member Author

@typescript-bot cherry-pick this to release-5.1

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented May 30, 2023

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-5.1 on this PR at 2a9c204. You can monitor the build here.

@typescript-bot
Copy link
Copy Markdown
Collaborator

Hey @DanielRosenwasser, I've opened #54456 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request May 30, 2023
Component commits:
2a9c204 Use `replaceAll` instead of an incorrect `RegExp` for tsserver log sanitization.
DanielRosenwasser added a commit that referenced this pull request May 30, 2023
…e-5.1 (#54456)

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants