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

raw tagged string doesn't support for \x #39715

Closed
lygstate opened this issue Jul 23, 2020 · 3 comments · Fixed by #51837
Closed

raw tagged string doesn't support for \x #39715

lygstate opened this issue Jul 23, 2020 · 3 comments · Fixed by #51837
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@lygstate
Copy link

lygstate commented Jul 23, 2020

TypeScript Version: 3.9

Search Terms:

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

function raw(x: TemplateStringsArray)
{
    return x.raw;
}
const originEnv =raw`\x`

Expected behavior:

Running and output

Actual behavior:

ts-node gen-env.ts

C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:434
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
gen-env.ts:6:24 - error TS1125: Hexadecimal digit expected.

6 const originEnv =raw`\x`


    at createTSError (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:434:12)
    at reportTSError (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:438:19)
    at getOutput (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:578:36)
    at Object.compile (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:775:32)
    at Module.m._compile (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:858:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)

Playground Link:
https://www.staging-typescript.org/play?target=7#code/PTAEEFQKgZwUwDYDMC0BjA9gOwC4EMBLLOAEylBLgFtsYcAnPHA7UDJUHACzlAAd6GAEYJqoJBgQIMAdxgA6RQFgAUCFAAVOHU5cCMUEICeoegFcsWIgHNQAAxww0dtll29MVKniwkUCIjgAGlMmHnpdH11BM2suUB8MbjgIoTMCBBJODElQGDM0eLwDAHEzBD4QgHU4IT48NABrELgcNHlVVSQLNGZWRhkACgAPAC5Naj4EJjgAZQYbGHB6RiMASlUAb1VQXdNWs3o3YfkBgG5VAF9VTCwdDHoCayIAUSwAN1AAXgG7AB1hnZVEA

Related Issues:

@lygstate
Copy link
Author

How to help?

@Kingwl
Copy link
Contributor

Kingwl commented Jul 27, 2020

It's related with #23801. But seems not easy to fix.
And as you can see. The output is work as expected.

@lino-levan

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
4 participants