2

Closed

Improve errors with incorrect require statements and AMD

description

/// <reference path="typings/jquery/jquery.d.ts"/>
import $ = require("jquery");


The second line above seems to be causing itself problems:
"; expected" with "Expression statement is not assignment or call" immediately following it.

The js however seems to be generated just fine.

file attachments

Closed Jul 28 at 11:18 PM by jonturner
As part of our move to GitHub, we're closing our CodePlex suggestions and asking that people move them to the GitHub issue tracker for further discussion. Some feature requests may already be active on GitHub, so please make sure to look for an existing issue before filing a new one.

You can find our GitHub issue tracker here:
https://github.com/microsoft/typeScript/issues

comments

RyanCavanaugh wrote Sep 17, 2013 at 12:44 AM

It looks like you're trying to use a non-AMD jquery.d.ts file. You'll need to find or produce a .d.ts file that defines the jquery types for use in AMD to use 'import' with it

** Closed by RyanCavanaugh 09/16/2013 4:44PM

catsgotmytongue wrote Sep 17, 2013 at 3:30 PM

I'm using the one from definitely typed and I'm pretty sure that's AMD. In either case this is still an issue as I get it on every single require statement I have.

Also I used an amd specific reference for knockout from definitely typed that yields the same result as above.

catsgotmytongue wrote Sep 17, 2013 at 3:33 PM

also even if it was non-AMD it should not be saying "; expected" or "expression statement is not assignment or call", it should be saying something more to the effect of the actual problem such as "attempting to use non-amd module where amd module was expected.

danquirk wrote Sep 18, 2013 at 10:20 PM

Changing to a suggestion and assigning to Jonathan. There are certainly no shortage of parser errors we would like to 'upgrade' to more actionable semantic errors.

catsgotmytongue wrote Oct 15, 2013 at 3:38 PM

Just FYI, I only encounter this inside Visual Studio with my typescript code.

catsgotmytongue wrote Oct 17, 2013 at 1:48 AM

another update:
it didn't occur to me until today but when I disabled typescript support in resharper(didn't know this was available in resharper 8) the "; expected" followed by "expression statement is not assignment or call" problem went away. Intellisense still doesn't completely work right but I think it has more to do with my setup because I didn't see any of these issues on a fresh install of VS2012 with typescript only.

I think this was largely a conflict with resharper and so it shouldn't be considered an issue in typescript.

I suggest closing the issue.