Skip to content

Question: How to get the types array to load using System.js. #170

Closed
@bennadel

Description

@bennadel

I am currently using the plugin-typescript to do in-browser compiling of an Angular 2 application, but I can't seem to get the types to be loaded. Here are the typescript options I have in my system.js config:

typescriptOptions: {
    emitDecoratorMetadata: true,
    experimentalDecorators: true,
    module: "commonjs",
    moduleResolution: "node",
    noImplicitAny: true,
    removeComments: false,
    sourceMap: true,
    suppressImplicitAnyIndexErrors: true,
    target: "es5",
    typeCheck: true,
    types: [ "node" ]  // <---- This is the part I am trying to get to work.
}

... notice the types: [ "node" ]. However, when I load the app, I do not see any network requests to node_modules/@types/node. Is there something that I have to do to tell the typescript plugin to actually load the types?

Because it's not loading, my references to moduleId: module.id are throwing the error:

TypeScript [Error] Cannot find name 'module'. (TS2304)

Everything else is working, in so much as the .ts files are being loading and transpiled to es5 and my Angular 2 app loads. I just can't figure out how to get rid of that compiler error. Thanks!

Also, my dependencies in package.json:

"dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/router": "3.1.1",
    "@types/core-js": "^0.9.34",
    "@types/node": "^6.0.45",
    "core-js": "^2.4.1",
    "plugin-typescript": "5.2.7",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "typescript": "^2.0.3",
    "zone.js": "^0.6.25"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions