Skip to content
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

Issue with typings in WebWorker bundle #4902

Closed
jteplitz opened this issue Oct 25, 2015 · 84 comments
Closed

Issue with typings in WebWorker bundle #4902

jteplitz opened this issue Oct 25, 2015 · 84 comments

Comments

@jteplitz
Copy link
Contributor

If I create a new angular 2 project using alpha 44 from NPM and attempt to load the webworker bundle in my TypeScript project I get the following errors during compilation. It looks like the facade types are not loading for some reason.

node_modules/angular2/src/core/change_detection/parser/locals.d.ts(3,14): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/change_detection/parser/locals.d.ts(4,42): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'.
node_modules/angular2/src/core/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'.
node_modules/angular2/src/core/facade/collection.d.ts(4,27): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(4,39): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(7,9): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(8,30): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(11,43): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(12,27): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(14,23): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(15,25): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/collection.d.ts(94,41): error TS2304: Cannot find name 'Set'.
node_modules/angular2/src/core/facade/collection.d.ts(95,22): error TS2304: Cannot find name 'Set'.
node_modules/angular2/src/core/facade/collection.d.ts(96,25): error TS2304: Cannot find name 'Set'.
node_modules/angular2/src/core/facade/lang.d.ts(1,22): error TS2304: Cannot find name 'BrowserNodeGlobal'.
node_modules/angular2/src/core/facade/lang.d.ts(33,59): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/facade/promise.d.ts(1,10): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(3,14): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(8,32): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(9,38): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(10,35): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(10,93): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(11,34): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(12,32): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(12,149): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/facade/promise.d.ts(13,43): error TS2304: Cannot find name 'Promise'.
node_modules/angular2/src/core/linker/element_injector.d.ts(72,32): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/element_injector.d.ts(74,17): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/element_injector.d.ts(78,184): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/element_injector.d.ts(83,182): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/element_injector.d.ts(107,37): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/proto_view_factory.d.ts(27,146): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(52,144): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(76,79): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(77,73): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(94,31): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(97,18): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(100,24): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(103,142): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/linker/view.d.ts(104,160): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/render/api.d.ts(281,74): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/core/zone/ng_zone.d.ts(1,37): error TS2304: Cannot find name 'Zone'.
node_modules/angular2/src/web_workers/shared/serializer.d.ts(11,22): error TS2304: Cannot find name 'Map'.
node_modules/angular2/src/web_workers/shared/serializer.d.ts(14,34): error TS2304: Cannot find name 'Map'.
@NetanelBasal
Copy link

+1

1 similar comment
@cosmaioan
Copy link

+1

@jteplitz jteplitz self-assigned this Nov 3, 2015
@jteplitz jteplitz added this to the beta-01 milestone Nov 3, 2015
@westonganger
Copy link

+1

@brukbelachew
Copy link

Is there a work around until it's fixed in beta-01?

@ghost
Copy link

ghost commented Nov 6, 2015

+1

@jteplitz
Copy link
Contributor Author

jteplitz commented Nov 7, 2015

There's not a workaround at the moment. I'm hoping to close this next week
though.

However, since typescript still produces output even with typing errors
this doesn't actually block development, it just creates a more verbose
compilation step.

On Fri, Nov 6, 2015, 3:28 PM Laicos Lee notifications@github.com wrote:

+1


Reply to this email directly or view it on GitHub
#4902 (comment).

@brukbelachew
Copy link

This issue doesn't still seem fixed in version 46.. any update please?

@jteplitz
Copy link
Contributor Author

We're reworking WebWorker bootstrap and the import paths for beta0 (See #4834). As a result we'll be removing the WebWorker specific import paths in favor of importing directly from angular2/core, angular2/di, angular2/forms, etc...

Once I finish that, the typings should no longer be a problem because WebWorkers will be using the same .d.ts files as the regular angular bundle (minus the browser platform files and adding in the WebWorker platform files).

@brukbelachew
Copy link

Thanks... will look forward for beta0.

@poiati
Copy link

poiati commented Dec 16, 2015

Is this fix in beta.0?

@jteplitz
Copy link
Contributor Author

Yup! Sorry for forgetting to upgrade this issue. The web_worker/worker and web_worker/ui import paths are gone in beta0. You can import directly from angular2/core, angular2/http, etc.. now. Bootstrap has changed as well. To see a full example of using WebWorkers in beta0 check out the Todo example here.

@jteplitz
Copy link
Contributor Author

You can also read the docs for WebWorker bootstrap here.

@Saint48198
Copy link

How was this resolved? I'm using beta.0 and still have the issue. Thanks

@Ken-vdE
Copy link

Ken-vdE commented Feb 3, 2016

+1 same issue.

@jteplitz
Copy link
Contributor Author

jteplitz commented Feb 4, 2016

@Saint48198 The issue should have been fixed in beta.0. If you're still experiencing issues can you please post the full error text here? Also, make sure that you are not importing from web_worker/worker or web_worker/ui anywhere in your code base. These paths are problematic and will be removed soon.

@dissplay
Copy link

+1 same issue (2.0.0-beta.5)

@DiegoYungh
Copy link

+1 same issue 2.0.0-beta.3

@DiegoYungh
Copy link

I got my stuff working after I added the Typings in the filesGlob
inside my tsconfig.json

"filesGlob": [
    "./src/**/*.ts",
    "./test/**/*.ts",
    "!./node_modules/**/*.ts",
    "src/custom_typings.d.ts",
    "typings/browser.d.ts"
],

@digitaldonkey
Copy link

@DiegoYungh Your workaround didn't work for me. Can you explain, what your intention was with this fix?

@jteplitz
Copy link
Contributor Author

@digitaldonkey What typings issues are you seeing? If it's that typescript can't find the angular imports then you need to include your entry point in the files array of your tsconfig file. Can you please post the full error that you get from the TS compiler, so I can see if it's related to this issue?

@digitaldonkey
Copy link

I can't promise that I'm in the right problem, but you can have a look.

$ gulp webpack
[19:25:31] Using gulpfile ~/htdocs/yoman-angula-test2/gulpfile.js
[19:25:31] Starting 'clean'...
[19:25:31] Finished 'clean' after 3.49 ms
[19:25:31] Starting 'webpack'...
ts-loader: Using typescript@1.8.0 and /Users/tho/htdocs/yoman-angula-test2/src/tsconfig.json

stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^
Error: /Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/change_detection/parser/locals.d.ts
(3,14): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/change_detection/parser/locals.d.ts
(4,42): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/debug/debug_node.d.ts
(14,13): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/debug/debug_node.d.ts
(24,17): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/debug/debug_node.d.ts
(25,17): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(1,25): error TS2304: Cannot find name 'MapConstructor'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(2,25): error TS2304: Cannot find name 'SetConstructor'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(4,27): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(4,39): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(7,9): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(8,30): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(11,43): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(12,27): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(14,23): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(15,25): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(95,41): error TS2304: Cannot find name 'Set'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(96,22): error TS2304: Cannot find name 'Set'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/collection.d.ts
(97,25): error TS2304: Cannot find name 'Set'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/observable/PromiseObservable.d.ts
(9,31): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/observable/PromiseObservable.d.ts
(10,26): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/observable/FromObservable.d.ts
(7,38): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/observable/FromObservable.d.ts
(7,51): error TS2304: Cannot find name 'Iterator'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/observable/ForkJoinObservable.d.ts
(6,50): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/observable/ForkJoinObservable.d.ts
(7,58): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/CoreOperators.d.ts
(35,67): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/CoreOperators.d.ts
(50,66): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/CoreOperators.d.ts
(89,67): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/CoreOperators.d.ts
(94,38): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/CoreOperators.d.ts
(94,50): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(46,62): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(47,42): error TS2304: Cannot find name 'Iterator'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(103,74): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(103,84): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(143,66): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(158,65): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(201,66): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(206,38): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/rxjs/Observable.d.ts
(206,50): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/render/api.d.ts
(13,13): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/render/api.d.ts
(14,84): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/platform/dom/dom_adapter.d.ts
(85,42): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/di/provider.d.ts
(436,103): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/core/di/provider.d.ts
(436,135): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/platform/browser/browser_adapter.d.ts
(75,33): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(1,10): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(3,14): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(8,32): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(9,38): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(10,35): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(10,93): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(11,34): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(12,32): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(12,149): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/promise.d.ts
(13,43): error TS2304: Cannot find name 'Promise'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/lang.d.ts
(13,17): error TS2304: Cannot find name 'Map'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/lang.d.ts
(14,17): error TS2304: Cannot find name 'Set'./Users/tho/htdocs/yoman-angula-test2/node_modules/angular2/src/facade/lang.d.ts
(78,59): error TS2304: Cannot find name 'Map'.

package.json:


{
  "name": "eth-tweet-ui",
  "version": "0.0.1",
  "description": "",
  "author": "Thorsten Krug",
  "main": "",
  "scripts": {
    "start": "node server",
    "build": "gulp build"
    },
  "dependencies": {},
  "devDependencies": {
    "angular2": "^2.0.0-beta",
    "del": "^2.0.2",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "express": "^4.13.3",
    "gulp": "^3.9.0",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-concat": "^2.6.0",
    "gulp-cssnano": "^2.0.0",
    "gulp-html-replace": "^1.5.4",
    "gulp-htmlmin": "^1.0.5",
    "gulp-uglify": "^1.4.2",
    "livereload": "^0.4.0",
    "reflect-metadata": "^0.1.2",
    "rxjs": "^5.0.0-beta.0",
    "systemjs": "^0.19.5",
    "ts-loader": "^0.7.2",
    "typescript": "^1.7.5",
    "webpack": "^1.12.2",
    "webpack-stream": "^3.1.0",
    "zone.js": "^0.5.10"
  }
}

tsconfig.json:

{
  "version": "1.8.0",
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "module": "commonjs",
    "removeComments": true,
    "sourceMap": false
  },
  "exclude": [
      "node_modules"
  ]
}

Using generator-angular2-gulp-webpack with yo.

@jteplitz
Copy link
Contributor Author

@digitaldonkey Are you still importing from the web_worker/worker or web_worker/ui path at all?

@jteplitz
Copy link
Contributor Author

Also, you should add the files that you call bootstrap from (both the render bootstrap and the app bootstrap), to a files array in your tsconfig.json file

@bitsagarob
Copy link

bitsagarob commented May 4, 2016

@VahidN try import Observable from '@reactivex/rxjs/dist/cjs/Observable';
and latest RxJS requires typescript 1.8 so upgrade to the latest typescript version.

@ronakvbhatt07 This means there's still no typings for the referenced name available. Do you have a tsconfig.json and typings.json file? Then run the typings install es6-promise command.
Also see Angular2 quickstart

@VahidN
Copy link

VahidN commented May 4, 2016

@segersrobbert I think this problem is related to rxjs 5.0.0-beta.6
Beta 6 is suggested with RC1 and it doesn't compile with TypeScript 1.8.10.

@ronakvbhatt07
Copy link

@segersrobbert yes i do have typings.json in that my code is like this

{
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160412134438"
 }
}

And when i try typings install es6-promise command it gives me No Dependency

@brendanalexdr
Copy link

I had similar problem after upgrading to Angular2 RC, and solved it as shown here: http://stackoverflow.com/a/36948893/3532945

@bitsagarob
Copy link

bitsagarob commented May 6, 2016

@ronakvbhatt07: typings install es6-promise es6-collections --ambient

@ronakvbhatt07
Copy link

ronakvbhatt07 commented May 6, 2016

@segersrobbert Hey, thanx for the solution i just got it right and now its working. Thank hyou

@ssuperczynski
Copy link

ssuperczynski commented May 6, 2016

@ronakvbhatt07 in the package.json do you have "rxjs": "5.0.0-beta.6" or "rxjs": "^5.0.0-beta.6" (with ^)?
I had to remove ^ because npm installed "rxjs": "5.0.0-beta.7" and it was causing the error

@ronakvbhatt07
Copy link

@ssuperczynski I do have "rxjs": "^5.0.0-beta.6", Let me try it without ^ then

@Cowlephant
Copy link

This is driving me mad, and I've been researching and trying various "fixes" for hours, but nothing seems to work.

Invalid module name in augmentation, module '../../Observable' cannot be found.

Property 'map' does not exist on type 'Observable'

are my two biggest headaches at the moment.

@robert35
Copy link

robert35 commented May 7, 2016

an article to help understand typings : http://blog.mgechev.com/2016/03/28/ambient-type-definitions-duplicate-identifier-typescript-fix/
it is brilliant !!

@bitsagarob
Copy link

@twilliamsgsnetx Since Angular 2.0.0-rc.0 you need the following:
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise';
And make sure you have installed the es6-shim typings

@IAMtheIAM
Copy link

@segersrobbert Which file do we need to add the import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; into? I'm still having this issue with webpack and angular 2 with typescript.

@brendanalexdr
Copy link

@IAMtheIAM see my recipe here this should help you: http://stackoverflow.com/a/36948893/3532945

@bitsagarob
Copy link

@IAMtheIAM wherever you use the map operator

@BobbyTable
Copy link

adding the 'rxjs/add/operator/map' (or any other rx operator) gives a corresponding error for its .d.ts file, and keeps the 'map does not exist' error:

Invalid module name in augmentation, module '../../Observable' cannot be found.

I have referenced /typings/browser/ambient/es6-shim/index.d.ts
tsc Version 1.8.9
rxjs: 5.0.0-beta.6

@VahidN
Copy link

VahidN commented May 10, 2016

Add this line to your main.ts file

import 'rxjs/Rx';   // Load all features

@BobbyTable
Copy link

@VahidN loading all rx-features just gives me hundreds of Observable-errors (one per rx feature that uses observable). It seems like its an issue with how visual studio handles typings, and ive decided to downgrade to rxjs beta 2, until the VS/TS team fixes it (still running angular2.rc1)

@VahidN
Copy link

VahidN commented May 10, 2016

You can overdrive the Visual studio's TypeScript compiler and use the nodejs one.
Open Tools->Options->Projects and Solutions->External Web Tools
Then move the $(PATH) variable to the top of the list. Now VS uses the latest installed npm and also latest tsc compiler which are provided by nodejs. Its (VS 2015 Update 2) builtin npm is very old {"node":"v0.10.31","npm":"1.4.9"}.
To check that, open the package manager console and then run tsc -v.
By using this method I was able to compile the solution (Rebuild solution). Output window shows it's completed the compilation without any errors. But the errors window shows hundreds of errors that you can ignore, because the final .js files are created without any problems.

@VahidN
Copy link

VahidN commented May 10, 2016

This issue has been reported here.

@Akimi
Copy link

Akimi commented Jun 2, 2016

I have solved this issues by following instructions in "TypeScript Typings" section in the angular doc. I have added "typings": "1.0.4" to package.json in devDependencies. Then I have added npm script

"scripts": {
    "postinstall": "typings install"
}

To make it work in Visual Studio with ASP Core, this article is also very helpfull.

This is my full package.json

{
    "name": "asp.net",
    "version": "0.0.0",
    "private": true,
    "devDependencies": {
        "gulp": "3.8.11",
        "gulp-concat": "2.5.2",
        "gulp-cssmin": "0.1.7",
        "gulp-uglify": "1.2.0",
        "gulp-sass": "2.3.1",
        "rimraf": "2.2.8",

        "typings": "1.0.4"
    },
    "dependencies": {
        "@angular/common": "2.0.0-rc.1",
        "@angular/compiler": "2.0.0-rc.1",
        "@angular/core": "2.0.0-rc.1",
        "@angular/http": "2.0.0-rc.1",
        "@angular/platform-browser": "2.0.0-rc.1",
        "@angular/platform-browser-dynamic": "2.0.0-rc.1",
        "@angular/router": "2.0.0-rc.1",
        "@angular/router-deprecated": "2.0.0-rc.1",
        "@angular/upgrade": "2.0.0-rc.1",

        "systemjs": "0.19.27",
        "core-js": "^2.4.0",
        "reflect-metadata": "^0.1.3",
        "rxjs": "5.0.0-beta.6",
        "zone.js": "^0.6.12",
        "es6-shim": "0.35.1"
    },
    "scripts": {
        "postinstall": "typings install"
    }
}

@youngplussoft
Copy link

youngplussoft commented Sep 29, 2016

edit [tsconfig.json]
"target": "es5" -> "target": "es2015",

$ npm install collections
It did work for me.
es6-collections is deprecated .

@Flounn
Copy link
Contributor

Flounn commented Oct 5, 2016

@youngplussoft Thx replace es5 by es2015 work for me

@ondrejchmelar
Copy link

That is not a solution, it will output es6 files, limiting browser support.

@ayoubde
Copy link

ayoubde commented Jan 3, 2017

/// <reference path="../../typings/globals/core-js/index.d.ts" />
reference path to index.d.ts

@hackerpc12
Copy link

hackerpc12 commented Jul 2, 2019

Well, this worked for me -
import {map} from 'rxjs/operators';

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests