microsoft / microsoft/TypeScript

JS files should parse as JS, not as JSX

Open
#45,166 8 comments 0 reactions 1 assignee View on GitHub

@sandersn is already working on this.

Since Jul 26, 2021.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Bug Report

🔎 Search Terms

TS1005 allowJS

🕗 Version & Regression Information

3.3.3

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about allowJS and TS1005
  • I was unable to test this on prior versions because playground
⏯ Playground Link

https://www.typescriptlang.org/play?jsx=0&ts=3.3.3&filetype=js#code/C4JwrgpgPABA9AHQEZwHTAgZ2ACgER4CU8cMA8gNIBQokUiK6WuBxcpAYgIICSAMlSA

💻 Code

tsc --allowJs --checkJs test.js

true< /\b/.test("") // OK
true</\b/.test("") // FAIL

This is a small reproducing example.
The real-world code causing this issue is: https://unpkg.com/froala-editor@4.0.3/js/froala_editor.min.js

🙁 Actual behavior
:2:2 - error TS1005: ';' expected.
:2:7 - error TS1127: Invalid character.
:2:10 - error TS1109: Expression expected.
🙂 Expected behavior

Compiles successfully, because line 1 and line 2 are semantically equal in JS.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.