Visual Studio 2015 Enterprise with ReSharper 10 Ultimate -- Cannot be properly resolved
Asked Answered
H

6

23

I have Visual Studio 2015 Enterprise, version 14.0.24720.00 Update 1 as well as ReSharper 10 Ultimate, version 10.0.2 installed. I have a typescript file that is using AtScript syntax to refer to the Angular2 directive module, as its annotation. However, ReSharper is stating the following error:

Symbol 'Directive' cannot be properly resolved, probably it is located in inaccessible module.

Below is the full error tooltip.

enter image description here

The application compiles and runs as expected, and the angular portions of the application also function as desired. It appears as though this is a ReSharper false negative. Is anyone familiar with a workaround other that simply disabling ReSharper or ignoring the warning?

Haver answered 4/1, 2016 at 13:35 Comment(0)
H
13

The issue is simply a bug with the latest version of ReSharper, if you Suspend ReSharper the issue simply goes away and all the source code works as expected.

Update

This has since been addressed in the ReSharper 2016.1 version.

Haver answered 19/1, 2016 at 16:48 Comment(3)
For what it's worth, this error - not necessarily in this precise scenario - is showing up for me in 2016.2.2, with TS 2.0.3, with the --strictNullChecks flag on.Dhruv
I am also seeing the error still in 2016.2.2 with TS 2.0.3. Typescript compiles fine - but it is complaining about momentjs.Seko
I'm seeing it in R# 2016.2.2 and 2016.3 EAP8, using TS 2.0.6. Like everyone else, TS is compiling fine, but Resharper complains. I think it started for me about the time I turned on strictNullChecks. Filed this bug: resharper-support.jetbrains.com/hc/en-us/requests/…Dhruv
P
2

As of 02/2016, the issue is fixed in the ReSharper Ultimate 10.1 EAP 3

this version still has some other typescript issues though

Original answer, explaining why it couldn't work in previous versions:

Had the same setup and same issue. I strongly believe this is related to: "moduleResolution": "node"

https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FRSRP-273158

Unfortunately, no way now. We're working on node.js support for the next ReSharper version.

Picard answered 4/1, 2016 at 20:5 Comment(4)
Yet there is probably no other help than a new Resharper releasePicard
Thank you, your answer led me to the solution. You can download the R# EAP version here: confluence.jetbrains.com/display/ReSharper/ReSharper+10.1+EAPOverbuild
I can confirm this fixed the issue... I used 10.1 EAP 7.Mule
I used 10.1 31 Mar EAP8 and it did not fix this issue.Outmarch
L
2

As a workaround, if you are using angular2 from your node_modules folder, then you can reference it directly instead of relying on the new node module resolution. For example you can do:

import {Directive} from '../../node_modules/angular2/core';
Liveried answered 7/1, 2016 at 4:40 Comment(2)
Indeed it is a work around, however; I'm looking for a permanent fix... What risks does this carry with it?Haver
If you move the file, you'll need to update the relative path of all your imports...Mannuela
I
1

If updating to latest ReSharper version does not work and this only affects .js(x) and .ts(x) files you only need to suspend those. You can do that by going to ReSharper -> Options -> Unclick JavaScript and TypeScript.

enter image description here

Inharmonious answered 8/9, 2018 at 9:56 Comment(1)
Although it's not my preferred solution I have no choice but have to do same. Nothing else helped and I tried many ideas found on the internet. However instead of disabling Resharper for ts files at all, I prefer to disable code inspecition for ts files so I still can use Code Cleanup function. Or even better, I just removed that one concrete error from popping up in the Inspectiuon Severity menu. I see this error reported for years, but hopefully, it will get fixed by JetBrains in some future patch.Duenas
P
0

It could be Resharper problem. disable it from tools->option->Resharper Ultimate->General->Suspend Now and the errors will be hide.

Peek answered 27/4, 2016 at 10:27 Comment(0)
A
0

I was getting the same problem on one of my modules on Resharper 2017.1 in Visual Studio 2017.

enter image description here

But after updating my Resharper to 2017.2.2, that solved the problem.

enter image description here

Acceptor answered 2/12, 2017 at 18:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.