-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Angular: Fix single-quoted union types in compodoc control inference #34904
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
Giazz73-Desavoie
wants to merge
1
commit into
storybookjs:next
from
Giazz73-Desavoie:fix/angular-single-quoted-union-controls
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In JavaScript/TypeScript single-quoted string literals, are escape sequences such as \n, \t, \\, \", \', and \uXXXX interpreted the same as in double-quoted strings, and what runtime string values do they produce?💡 Result:
In JavaScript and TypeScript, single-quoted ('...') and double-quoted ("...") string literals are semantically identical regarding escape sequences [1][2]. All standard escape sequences—including \n, \t, \, ", ', and \uXXXX—are interpreted and processed in exactly the same way regardless of whether the string is wrapped in single or double quotes [3][4][2]. When these escape sequences are used, they produce the following runtime string values: \n: Line Feed (LF) character (U+000A) [3][4] \t: Character Tabulation (horizontal tab) (U+0009) [3][4] \: Backslash (Reverse Solidus) (U+005C) [3][4] ": Quotation Mark (U+0022) [3][4] ': Apostrophe (U+0027) [3][4] \uXXXX: A character represented by the hexadecimal Unicode code point XXXX (e.g., \u0041 produces 'A') [3][5] Because both quote types are treated identically, the only functional difference is which character must be escaped to avoid prematurely terminating the string: you must escape the quote character used to define the literal [4][2]. For example, in a single-quoted string, a literal single quote must be escaped as ', while a double quote can appear literally [2]. Conversely, in a double-quoted string, a literal double quote must be escaped as ", while a single quote can appear literally [2]. All other escape sequences remain fully interchangeable [2].
Citations:
Decode all valid escape sequences in the single-quoted enum segment parser (lines 133-147 in
code/frameworks/angular/src/client/compodoc.ts)The current single-quoted branch only unescapes
\'(s.slice(1, -1).replace(/\\'/g, "'")) and leaves other valid TypeScript/JavaScript string escapes (e.g.\n,\t,\\,\",\uXXXX) undecoded, so inferred enum option values can diverge from the actual runtime strings.🤖 Prompt for AI Agents