Closed wizardnet972 closed 8 years ago
I don't think there's strong difference between visual studio to other editor configurations since compilation goes through typescript compiler. Would you be able to share what's tsc version and small code snippet able to reproduce issue?
Same issue and looks like same problem here: http://stackoverflow.com/questions/37030963/angular-2-2-0-0-rc-1-property-map-does-not-exist-on-type-observableresponse
I wrote the following in a different git repo (apparently it's was the wrong repo to discuss RxJS v5).
There seems to be a problem with the node module resolutions with all the Rx operators in Visual Studio 2015. No matter what I try, I can not seem to get rid of these typescript errors. For example, when using the RxJS map operator within Angular2 Quickstart package, Visual Studio complains:
Severity: Error Code: TS2664 Description: Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects Project File: C:\Angular2-Quickstart\node_modules\rxjs\add\operator\map.d.ts Line: 2
I have several other npm packages that my typescript project does not complain about. Just the RxJS operators. For some reason, when I browse to any type definition file under _"nodemodules\rxjs\add\operator" all of them are showing the above error on the line with
declare module '../../Observable' {
My project compiles fine using both the typescript's CLI and Visual Studio's built in compiler, but I am getting a flood of these errors in Visual Studio's error window. It also breaks Typescript's intellisense. I have attempted to include a reference path to Rx.KitchenSink. But I just get more of the same errors. Unfortunately nothing seems to be solving this issue.
/// <reference path="../node_modules/rxjs/Rx.KitchenSink.d.ts"/>
My tsconfig.json:
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
}
My typings.json:
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"
...
}
I am using the latest version of everything: Windows 10 Visual Studio Enterprise 2015: Version 14.0.25123.00 Update 2 Typescript Version: 1.8.30.0 npm package: "rxjs": "5.0.0-beta.7" (Errors also occurs with 5.0.0-beta.6) Node: v6.1.0 (I don't think it is relevant, but also occurs on a system with Node v5)
I have a second system with a similar setup, the errors also occur there.
Please see this thread for a description of the issue and workaround
@vladima You are a life saver. Thanks.
Appreciate for workaround @vladima . One of reason I switched from VS is about using typescript.. wish VS15 will enhance support.
Let me close this issue for now since it's tooling environment, @wizardnet972, please reopen / create new issue if there's something unresolved.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
In every *.d.ts under rx/add, should add:
import {Observable} from '../../Observable';
for visual studio typescript compiler / intellisense compatibility.
visual studio error message: Invalid module name in augmentation, module '../../Observable' cannot be found.
for example:
should be:
based on https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#augmenting-globalmodule-scope-from-modules