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

StringLiteral AST-Node has wrong text property #16788

Closed
ajafff opened this issue Jun 28, 2017 · 1 comment
Closed

StringLiteral AST-Node has wrong text property #16788

ajafff opened this issue Jun 28, 2017 · 1 comment
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript

Comments

@ajafff
Copy link
Contributor

ajafff commented Jun 28, 2017

TypeScript Version: 2.3.4
Code

const obj = {};
let foo = "__id__"; /* 1 */
obj["__id__"] = "foobar"; /* 2 */

Expected behavior:

the text property of StringLiteral contains __id__ in both cases.

Actual behavior:
case 1: node.text === "__id__" as expected
case 2: node.text === "___id__" (note the third underscore)

It seems like typescript encodes the second StringLiteral similar to Identifiers, but the current behavior is inconsistent.

Ref: palantir/tslint#2965

@mhegazy mhegazy added API Relates to the public API for TypeScript Bug A bug in TypeScript labels Aug 24, 2017
@ajafff
Copy link
Contributor Author

ajafff commented Aug 30, 2017

As of v2.5.0 this is no longer an issue. Seems to be fixed by the changed handling of escaped identifiers.

@ajafff ajafff closed this as completed Aug 30, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants