X Tutup
Skip to content

angular2.d.ts references globals-es6.d.ts but core.d.ts doesn't #5596

@IgorMinar

Description

@IgorMinar

as we are moving from import ... from 'angular2/angular2' to import ... from 'angular2/core' we are starting to hit typescript compiler errors like this:

[DiffingTSCompiler]: Typescript found the following errors:
  app/sample-38.spec.ts (8, 32): Property 'toBe' does not exist on type 'NgMatchers'.
  app/sample-38.spec.ts (13, 35): Property 'toBe' does not exist on type 'NgMatchers'.
  app/sample-38.spec.ts (14, 37): Property 'toBe' does not exist on type 'NgMatchers'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/CoreOperators.d.ts (21, 70): Cannot find name 'Promise'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/CoreOperators.d.ts (74, 31): Cannot find name 'PromiseConstructor'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/CoreOperators.d.ts (74, 54): Cannot find name 'Promise'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/Observable.d.ts (63, 53): Cannot find name 'PromiseConstructor'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/Observable.d.ts (63, 74): Cannot find name 'Promise'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/Observable.d.ts (74, 38): Cannot find name 'Promise'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/Observable.d.ts (97, 69): Cannot find name 'Promise'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/Observable.d.ts (149, 30): Cannot find name 'PromiseConstructor'.
  node_modules/angular2/node_modules/@reactivex/rxjs/dist/cjs/Observable.d.ts (149, 53): Cannot find name 'Promise'.
  node_modules/angular2/src/core/change_detection/parser/locals.d.ts (3, 14): Cannot find name 'Map'.
  node_modules/angular2/src/core/change_detection/parser/locals.d.ts (4, 42): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/element_injector.d.ts (71, 32): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/element_injector.d.ts (73, 17): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/element_injector.d.ts (77, 184): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/element_injector.d.ts (82, 182): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/element_injector.d.ts (106, 37): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/proto_view_factory.d.ts (28, 146): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (52, 144): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (76, 79): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (77, 73): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (95, 31): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (98, 18): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (101, 24): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (104, 162): Cannot find name 'Map'.
  node_modules/angular2/src/core/linker/view.d.ts (105, 160): Cannot find name 'Map'.
  node_modules/angular2/src/core/render/api.d.ts (289, 74): Cannot find name 'Map'.
  node_modules/angular2/src/core/zone/ng_zone.d.ts (2, 37): Cannot find name 'Zone'.
  node_modules/angular2/src/facade/collection.d.ts (1, 25): Cannot find name 'MapConstructor'.
  node_modules/angular2/src/facade/collection.d.ts (2, 25): Cannot find name 'SetConstructor'.
  node_modules/angular2/src/facade/collection.d.ts (4, 27): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (4, 39): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (7, 9): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (8, 30): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (11, 43): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (12, 27): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (14, 23): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (15, 25): Cannot find name 'Map'.
  node_modules/angular2/src/facade/collection.d.ts (90, 41): Cannot find name 'Set'.
  node_modules/angular2/src/facade/collection.d.ts (91, 22): Cannot find name 'Set'.
  node_modules/angular2/src/facade/collection.d.ts (92, 25): Cannot find name 'Set'.
  node_modules/angular2/src/facade/lang.d.ts (2, 22): Cannot find name 'BrowserNodeGlobal'.
  node_modules/angular2/src/facade/lang.d.ts (47, 59): Cannot find name 'Map'.
  node_modules/angular2/src/facade/promise.d.ts (1, 10): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (3, 14): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (8, 32): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (9, 38): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (10, 35): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (10, 93): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (11, 34): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (12, 32): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (12, 149): Cannot find name 'Promise'.
  node_modules/angular2/src/facade/promise.d.ts (13, 43): Cannot find name 'Promise'.
  node_modules/angular2/src/platform/browser/browser_adapter.d.ts (72, 33): Cannot find name 'Map'.
  node_modules/angular2/src/platform/dom/dom_adapter.d.ts (84, 42): Cannot find name 'Map'.
  node_modules/angular2/src/testing/matchers.d.ts (1, 37): Cannot find namespace 'jasmine'.

This is because when importing from angular2/angular, we are pulling in angular2.d.ts which pulls in globals-es6.d.ts. However when importing from angular2/core we no longer pull in the globals-es6.d.ts file, which results in all kinds of typings missing.

To work around this, developers need to explicitly refer to this d.ts file via tripple-slash reference or via tsconfig.json. (example: https://github.com/angular/angular-cli/pull/85/files#r46653752).

Note: globals-es6.d.ts is actually pretty problematic because it pulls in type definitions for not only es6 shims, but also jasmine, promises and bunch of other stuff. This is pretty messy and we should find a better way to do it, but that's a separate issue.

// @rkirov @alexeagle @mprobst @cironunes @vsavkin

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup