TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Invalid module name in augmentation

Open wizardnet972 opened this issue 10 years ago • 114 comments

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?

wizardnet972 avatar May 08 '16 19:05 wizardnet972

can you share a sample project we can look at?

mhegazy avatar May 08 '16 22:05 mhegazy

did visual studio 2015 uses latest typescript release? Rxjs 5 uses module augumentation introduced at 1.8 (https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#augmenting-globalmodule-scope-from-modules ) ?

wizardnet972 avatar May 09 '16 04:05 wizardnet972

Same problem here.

pantonis avatar May 09 '16 12:05 pantonis

Same here, "rxjs": "5.0.0-beta.6" as well as beta.7 VS 2015 with Update 2 and all installed updates. TS version is of course >1.8

ghost avatar May 09 '16 13:05 ghost

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 avatar May 09 '16 13:05 bcrigler

@bcrigler no way to point VS to use local TypeScript compiler. We have to wait next extention update. Or you can separate your web project into VS Code project + Service project for C# logic and use local TS with VS code.

ghost avatar May 09 '16 16:05 ghost

Do not do this if you have Update 3 RTM installed

I see the issue now. this is a duplicate of https://github.com/Microsoft/TypeScript/issues/7415, and should be fixed in the next release (see https://github.com/Microsoft/TypeScript/pull/7507).

As work arounds for now, you can replace C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js with the file in https://raw.githubusercontent.com/Microsoft/TypeScript/Fix8518/lib/typescriptServices.js. First take a local backup though.

mhegazy avatar May 09 '16 19:05 mhegazy

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

tserr "

giancarloa avatar May 09 '16 21:05 giancarloa

What version of VS are you using? update 2?

mhegazy avatar May 09 '16 21:05 mhegazy

@mhegazy ... no i am using update1... i guess i should be using update 2 correct???

giancarloa avatar May 09 '16 21:05 giancarloa

correct.

mhegazy avatar May 09 '16 21:05 mhegazy

Got it working with the "workaround". Thank you @mhegazy !!!

bcrigler avatar May 09 '16 21:05 bcrigler

@mhegazy This fixed the problem for me ^_^

ZenSoftware avatar May 10 '16 03:05 ZenSoftware

Can confirm, solution by @mhegazy works with rxjs 5.0.0-beta.6

BobbyTable avatar May 11 '16 07:05 BobbyTable

+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 avatar May 17 '16 13:05 mcanic

@mcanic I've got it working under C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js. It's not a bug, it's a missing feature in current VS tools version.

ghost avatar May 17 '16 13:05 ghost

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. Should we report this bug somewhere?

mcanic avatar May 17 '16 14:05 mcanic

this is a duplicate of #7415, and should be fixed in the next release (see #7507).

mhegazy avatar May 17 '16 18:05 mhegazy

Hi @mhegazy it is possible to refresh VS2013 in order to apply the same fix ?

acostaf avatar May 31 '16 09:05 acostaf

you can use the same steps in https://github.com/Microsoft/TypeScript/issues/8518#issuecomment-217960231 for VS 2013, the location would be C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js (12.0 instead of 14.0 in the path).

mhegazy avatar May 31 '16 19:05 mhegazy