Skip to content

tsc produces invalid JavaScript when there is a comment between a numeric literal and a method call on that number #28868

@T-Hugs

Description

@T-Hugs

TypeScript Version: 3.2.1

Search Terms: allowjs comment number numeric literal two dots after comment

Code
file.js

0 /* any comment */.toString();

Run: tsc file.js --allowJS --outFile out.js

Expected behavior:
out.js has the same content as file.js

Actual behavior:
out.js contains the following:

0 /* any comment */..toString();

Which is a syntax error: SyntaxError: Unexpected token .

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions