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.
I updated to Resharper 2016.2 and this issue was resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With