-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Invalid module name in augmentation #8518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
can you share a sample project we can look at? |
did visual studio 2015 uses latest typescript release? |
Same problem here. |
Same here, "rxjs": "5.0.0-beta.6" as well as beta.7 |
Installed the latest 1.8.6 download from Microsoft as a VS extension experiencing the same issue... How do I point Visual Studio to use the local version of Typescript installed locally within my project? (which I have 1.8.10 installed locally) |
@bcrigler no way to point VS to use local TypeScript compiler. We have to wait next extention update. |
Do not do this if you have Update 3 RTM installed I see the issue now. this is a duplicate of #7415, and should be fixed in the next release (see #7507). As work arounds for now, you can replace |
Hi there @mhegazy ... I tried your suggestion... but now when I try to open the project I get the error "API version mismatch: manager version 0.4, script version 0.5"... any ideas? thanks |
What version of VS are you using? update 2? |
@mhegazy ... no i am using update1... i guess i should be using update 2 correct??? |
correct. |
Got it working with the "workaround". Thank you @mhegazy !!! |
@mhegazy This fixed the problem for me ^_^ |
Can confirm, solution by @mhegazy works with rxjs 5.0.0-beta.6 |
+1 conformed, solution of @mhegazy works, except for that I had to modify node_modules\typescript\lib\typescriptServices.js under my project folder instead of C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js. Is this a typescript bug then? If so, will it be fixed in the next version, and is this the right fix? |
@mcanic I've got it working under |
I'm sure you are right, because I saw that the tsc command compiled fine, but I don't get how this can be a missing feature in the current VS tools version? Update: of course: it is not typescript, it IS the VS extension itself where the fix was applied, I get it now. |
VS Tooling Fix: microsoft/TypeScript#8518
Hi @mhegazy it is possible to refresh VS2013 in order to apply the same fix ? |
you can use the same steps in #8518 (comment) for VS 2013, the location would be |
Doesn't work, I've got the API error so have to rolled it back, I've am on the latest service pack |
@mhegazy |
@tylerjgarland: Had similar issue. After uninstalling it and reinstalling it, even code highlighting or formatting would work, not even with 1.8 Version. So I installed the tools and ran If that doesn't work delete the file in the visual studio folder that was replaced in the steps above, do a Visual Studio repair (not TypeScript), the install TypeScript and if still necessary, repeat the step above |
Thanks, @TsengSR I'll give that a shot and report back. I tried just install [email protected] but same Issue. I'll do a repair. |
@TsengSR , @mhegazy It didn't work. I deleted the files. Repaired VS 2015. Installed 2.0.3.0. Ran npm install -g [email protected]. Still nothing. |
I updated gulp-typescript to 3.0.1 and typescript 2.0.1 in my package.json. Ran a typescript build using gulp and then intellisense started working. I'm not actually sure what fixed it. Hell, it could be just keeping it open for a while too. I have to upgrade the other devs though so if anyone has clarity on how that fixed my issues, I'd be very thankful. |
I had the same problem. I ended up going to programs and feature and uninstalled all previous versions of TypeScript Tools for Microsoft Visual studio, then I installed the latest version of TypeScript tools version 2.X https://www.microsoft.com/en-us/download/details.aspx?id=48593 and this fixed the problem. |
This issue would have been a deal-breaker for using Angular 2 on my new project at work. Thanks @Oncidium. That did the trick. |
@Oncidium ,I was using the built-in version for update 3 which I believe was 1.8.6 so there was nothing to uninstall. |
@tylerjgarland As far as uninstalling, I figure you can never be too careful with these things. What fixed my problem is actually installing Visual Studio's TypeScript tools 2.0. |
So I have a workaround but it's obnoxious. If I type the correct import statement, save it, and restart visual studio it seems the intellisense cache is rebuilt and it works. |
This is my environment:
I have the following test project...
When editing a .ts file in The .ts files compile and the project runs successfully without compile-time warnings or errors, perhaps suggesting this is a Visual Studio tooling problem rather than a core TypeScript issue(?) To try and resolve this problem I have...
But still the problem exists. Any suggestions on what I can try next? UPDATEIn the end, the following fixed it for me:
|
@Neilski , have you tried unloading and reloading the project. Sometimes you have to prime intellisense. I also benefited from enabling this option. |
@tylerjgarland , I'd pretty much tried everything and had got into the habit of actually exiting Visual Studio and, fairly regularly rebooting the whole PC (ain't SSDs great?), but nothing worked until I played around with VS's TypeScript options as described above, and immediately everything started to work. Thinking about it, I guess this makes sense, as the NPM imported/generated code was not included in the project, but it did seem odd that this fix was better/more prolifically mentioned in the posts that I had looked at. For reference, this is what fixed it for me (which is in alignment with my |
@Neilski these changes should have no impact if you have a tsconfig.json. i would say you are running into a different issue. Please file an new issue and share some context to be able to investigate it. |
I do have a For your reference, here is my tsconfig.json...
I am not sure of why, but the project builds with the TypeScript Project Options set as described, but would not without the automatic compilation set. |
Can you please share a project we can try with? also i would appreciate it if you file a new issue. |
The project is part of a commercial contract, but I will try and replicate the problem in a new project. Thanks for your help. |
We have tried to replicate this problem, but without success. Interestingly, if we turn these settings off in the original project, it now compiles without error. As far as I know, nothing else has changed. So, in summary, it appears that the problem has resolved itself, just not sure how/why. |
Wow, had a big headache today when updating to TypeScript 2.0.6.. All errors returned that was fixed with the custom typescriptServices.js file (e.g. "Cannot find module 'angular2/core'", "set 'experimentalDecorators' to true", "'example' is not a valid property for window" etc. etc.). This is what my tsconfig.json file looked like:
I tried everything, uninstalled all previous versions of typescript, tools for VS2015, rebooted several times etc. Nothing helped. Then I started mixturing with the settings in my tsconfig.json file and noticed that it started working after i removed several options. And after some trial and error of adding them back one by one, the culprit was found to be the "include" option. So my current tsconfig.json looks like this (and works with 2.0.6):
Strange thing is that the previous tsconfig.json worked perfectly fine with TS 1.8.x |
|
Ah, that would explain it. Thanks! Edit: Acctually, it explains 'cannot find module ...' and '... not valid property of window' errors. But the 'experimentalDecorators' should not have been an error? (For .ts files in /App) |
Apologies if this comment does not apply, but I don't have time to follow all the details in this thread. I restored a file for a hotfix suggested by @mhegazy on May 9, in case anyone needs it: https://gist.github.com/amypellegrini/a48eb0c21f65dcb501766e69c2d8b765.js Advice: use it at your own risk and do some research first, I'm applying this hotfix as suggested by my colleagues and there are probably many details I'm missing related to this issue, I just want to make sure anyone else can have access to this file in case it needs to. |
Using rxjs "5.0.0-beta.12" I copied my local "node_modules\typescript\lib\typescriptServices.js" to "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript" and restarted Visual Studio 2015 Update 3, the problem was fixed. |
Hi, I've tried following all these tricks but none worked. I created a brand new project on github with the problem: Does anyone have a clue of what could be the problem? |
@hobojoe . I added an es6-shim.d.ts to your project ...added a map import in your service and a reference to the es6-shim.d.ts and your app builds fine inside and outside visual studio. See the changes I made to your project. Confirm if this resolves your issue. Outside Visual Studio |
Hi @abidmix The strange thing is that, as mentioned by @VahidN, I was following a guide from @chsakell and I could use his project without the need to follow the steps you described. That is odd to me, that for one project everything works without adding the custom import and mine doesn't and I have to add it to work.... Thanks anyway, your assistance was very helpful!! |
Upgrading to the latest TypeScript for Visual Studio 2015 fixed the issue for me. |
VS Tooling Fix: microsoft/TypeScript#8518
Hi,
In visual studio, i got this error in every d.ts file under node_modules\rxjs\add\observable\ :
Invalid module name in augmentation, module '../../Observable' cannot be found.
example code: declare module '../../Observable' {
how to fix that please?
The text was updated successfully, but these errors were encountered: