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

Error 'Unexpected Token' not displayed #4695

Closed
JustifiedFlaw opened this issue Mar 27, 2016 · 2 comments
Closed

Error 'Unexpected Token' not displayed #4695

JustifiedFlaw opened this issue Mar 27, 2016 · 2 comments

Comments

@JustifiedFlaw
Copy link

  • VSCode Version: 0.10.11
  • OS Version: OS X 10.10.5

Steps to Reproduce:

  1. Create a javascript file
  2. Type in
    var a = "abc".replace(new RegExp("abc", "g"), );

Expected: A warning that something should be between the comma and parentheses at the end

@Reanmachine
Copy link

I may be wrong, but I think this is actually a bug with TypeScript. I saved your example into both a .js and a .ts file and ran the following:

Output

As you can see both node and tsc (typescript) generate expected errors, but when typescript is parsing it as javascript it ignores the error. The output of tsc is as follows:

var a = "abc".replace(new RegExp("abc", "g"));

Since VSCode's diagnostics for JS are based on the TypeScript Server I feel that the EcmaScript5 mode of TypeScript doesn't see this as a problem because it just compiles the trailing parameter away.

There's an open Issue in the typescript project for TS to support trailing parameter lists Microsoft/TypeScript#7279

@Tyriar
Copy link
Member

Tyriar commented Mar 29, 2016

Thanks for deduping this @Reanmachine 👍

@Tyriar Tyriar closed this as completed Mar 29, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants