Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper is flagging my Promise as an error

I have the following Typescript code:

private getWorkbookFromFile(excelFile: File): Promise<xlsx.IWorkBook> {
    var loadedPromise = new Promise<xlsx.IWorkBook>((resolve, reject) => {
        // stuff to come up with the resolve.
    });

    return loadedPromise;
}

Visual studio is turning the word Promise red (as an error). But when I compile and run, it works fine.

I hit my head on the wall for this for a while then decided to turn off Resharper. Once I did syntax highlighting showed no errors! (And I can still compile and run.)

I am running Typescript targeting es6 (es2015). When you do that, you don't need extra typing (ie es6-promise) for Promises. Visual Studio knows that, but Resharper does not seem to know it.

So, the question is, how can I get Resharper to realize that my Typescript is targeting es6 (es2015) and that promise is OK?

I will have to develop without resharper for now, but I like the other things it gives, so I would LOVE a fix for this.

Things I have tried:

• Setting Javascript to ES6 (and Experimental) in the Resharper Options.
• Setting my Compiler Options to be ES6 (I also tried ES2015) in the tsconfig.json file.

like image 399
Vaccano Avatar asked Jul 07 '16 19:07

Vaccano


1 Answers

I updated to Resharper 2016.2 and this issue was resolved.

like image 78
Vaccano Avatar answered Sep 24 '22 05:09

Vaccano