2
Vote

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

comments

RyanCavanaugh wrote Sep 16, 2013 at 11:44 PM

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 2: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 2: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 9: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 2:38 PM

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

catsgotmytongue wrote Oct 17, 2013 at 12: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.